Tampermonkey / tampermonkey

Tampermonkey is the most popular userscript manager, with over 10 million users. It's available for Chrome, Microsoft Edge, Safari, Opera Next, and Firefox.
GNU General Public License v3.0
4.24k stars 419 forks source link

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

Closed machsix closed 4 years ago

machsix commented 4 years ago

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

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

derjanb commented 4 years ago

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.