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

[Firefox <=57] Incompatible with script produced by Webpack + Babel + core-js2 #834

Closed
machsix opened this issue Dec 10, 2019 · 1 comment

Comments

@machsix
Copy link

machsix commented Dec 10, 2019

Expected Behavior

Script runs normally like Chrome 48+Tampermonkey and produces the following content in the console
untitled2

Actual Behavior

An error is generated for Firefox 52 ESR or Firefox 57 with Tampermonkey
untitled

The error is not reproducible in

  • Firefox 52 ESR or Firefox 57 with Violentmonkey
  • Firefox 68 ESR with Tampermonkey
  • When bundle the script with core-js@2 but not core-js@3

Specifications

Script

The script is generated with Webpack + @babel/plugin-transform-runtime + @babel/runtime-corejs3. If I use Webpack + @babel/plugin-transform-runtime + @babel/runtime-corejs2, everything works normally. I hosted the minimum example at

Entry point is /src/index.js

The produced userscript is at /dist/test.user.js

@machsix machsix changed the title [Firefox <=57] Incompatible with script produced by Webpack + Babel [Firefox <=57] Incompatible with script produced by Webpack + Babel + core-js2 Dec 10, 2019
@derjanb
Copy link
Member

derjanb commented Dec 11, 2019

Well that's a Firefox issue. Somehow the FF folks thought it would be a good idea to have global properties which are not part of the global object.

Symbol is one of these in FF 52. That's why Tampermonkey misses this property.

You can workaround the issue by either adding

// @grant none

to your script or by adding

window.Symbol = Symbol;

as first line after the header.

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

No branches or pull requests

2 participants