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

Bundle can't be imported in non-browser environments since 0.15.0 #130

Merged
merged 1 commit into from Mar 12, 2020
Merged

Conversation

zakjan
Copy link
Contributor

@zakjan zakjan commented Mar 12, 2020

Since 0.15.0, graphology bundle can't be imported to non-browser environments, because of reference to window in Webpack wrapper.

Specifically importing in WebWorker causes promise rejection with null message in Chrome 80, ReferenceError: window is not defined in Firefox 73.

importScripts('https://unpkg.com/graphology@0.16.0/build/graphology.min.js');

The same error can be also triggered by importing bundle in NodeJS, if someone would prefer it to usual import from dist directory.

0.14.1 worked flawlessly.

This error is caused by Webpack upgrade to 4 and can be fixed by globalObject: 'this' in Webpack config. See discussion at markdalgleish/static-site-generator-webpack-plugin#130

…le to support importing in non-browser environments
@Yomguithereal
Copy link
Member

Thanks @zakjan. I didn't know that webpack made such a daft change to the way they bundle. On a side note, where are you using the built bundle outside of the browser?

@Yomguithereal Yomguithereal merged commit 1ac5467 into graphology:master Mar 12, 2020
@zakjan
Copy link
Contributor Author

zakjan commented Mar 12, 2020

Well, it was in WebWorker in browser, where window is not available. Maybe there is a better name for it.

@Yomguithereal
Copy link
Member

Do you need a npm release?

@zakjan
Copy link
Contributor Author

zakjan commented Mar 12, 2020

No rush, up to you.

@Yomguithereal
Copy link
Member

v0.16.1 is up

@zakjan
Copy link
Contributor Author

zakjan commented Mar 12, 2020

Hmm I'm getting another error with 0.16.1, TypeError: "exports" is read-only in FF, again just null in Chrome. Investigating.

@zakjan zakjan deleted the fix-build branch March 29, 2020 13:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants