Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
daphnesmit opened this issue Mar 1, 2021 · 0 comments · May be fixed by #543
Open

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

daphnesmit opened this issue Mar 1, 2021 · 0 comments · May be fixed by #543

Comments

@daphnesmit
Copy link

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant