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

Usage of has-symbols in GetIntrinsic.js breaks non-node usages of package #59

Closed
nvahalik opened this issue Oct 17, 2019 · 6 comments
Closed

Comments

@nvahalik
Copy link

In v1.15.0, GetIntrinsic.js started using has-symbols:

https://github.com/ljharb/es-abstract/blob/master/GetIntrinsic.js#L16

When called in a non-node environment, it causes an error since it is referencing global:

Uncaught (in promise): ReferenceError: global is not defined
./node_modules/has-symbols/index.js@http://my-app-here:2024:18
__webpack_require__@http://localhost:8100/runtime.js:84:30
./node_modules/es-abstract/GetIntrinsic.js@http://my-app-here:749:18
__webpack_require__@http://localhost:8100/runtime.js:84:30
./node_modules/es-abstract/es5.js@http://my-app-here:937:20
__webpack_require__@http://localhost:8100/runtime.js:84:30
./node_modules/string.prototype.trim/implementation.js@http://my-app-here:14204:10
__webpack_require__@http://localhost:8100/runtime.js:84:30

I have confirmed that reverting to v1.14.2 fixes the issue.

@ljharb
Copy link
Owner

ljharb commented Oct 17, 2019

global is the node global, and every bundler by default changes this to window for browsers.

Perhaps you've deviated from the default settings by adding node: false to your webpack config?

@nvahalik
Copy link
Author

My current use case is with Ionic v4. Angular builds the app just fine and this problem only happens during runtime.

@ljharb
Copy link
Owner

ljharb commented Oct 17, 2019

Building the app "just fine" would include transforming global to window for the browser, like every bundler has done since node has existed. I'm not familiar with Ionic specifically.

@nvahalik
Copy link
Author

@ljharb Apparently for Angular CLI this is no longer the case:

angular/angular-cli#9827 (comment)

Angular used to provide a shim for global but as of 6.x, it is not anymore.

@nvahalik
Copy link
Author

Closing this ticket out since the problem is actually in the has-symbol module.

@ljharb
Copy link
Owner

ljharb commented Oct 22, 2019

Then Angular has chosen to make much of the ecosystem incompatible ¯_(ツ)_/¯

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

No branches or pull requests

2 participants