crabbly / crabbly/Print.js

Print JS has window in dist/print.js and therefor doesnt work on SSR

Open
#542 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
4.5k
Forks
688
PR merge metrics
No merged PRs in 30d

Description

HI!

I am using print js and its great!
The only problem I am facing is that the dist/print.js had on line 10 a window declaration which will fail on ssr when trying to load the site with a printjs import.

First 10 lines of dist/print.js
```
(function webpackUniversalModuleDefinition(root, factory) {
if(typeof exports === 'object' && typeof module === 'object')
module.exports = factory();
else if(typeof define === 'function' && define.amd)
define([], factory);
else if(typeof exports === 'object')
exports["printJS"] = factory();
else
root["printJS"] = factory();
})(window, function() {
return /******/ (function(modules) {
```

According to this site https://zenuml.medium.com/window-is-undefined-in-umd-library-output-for-webpack4-858af1b881df

a fix would be adding globalObject this. I will check further but thought i'd create an issue already!

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.