-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
using Symbol causes exception in IE11 #514
Comments
Hi @zloirock I can confirm I am getting the same issue at the same line of Dependencies
Any help would be much appreciated :) Let me know if you need me to provide any further information. |
@andrewcourtice here could help a reproducible example. |
Maybe it's because of the different IE minor version. |
@zloirock removing the |
Can you provide the full stack trace? |
Unlikely. |
IE11 haven't native symbols. Are you sure that |
@zloirock that was the thing! I'm using webpacker which is in the latest release transpiles node modules. These changes fix it: const nodeModulesLoader = environment.loaders.get("nodeModules");
nodeModulesLoader.exclude = [].concat(nodeModulesLoader.exclude || []);
nodeModulesLoader.exclude.push(/core-js/); Thanks a lot for the help! if it is the same case for @andrewcourtice I would be happy to close the issue |
If it compiles node_modules by default, it might be worth reporting a bug to webpacker asking to also exclude core-js by default. |
How would compiling core-js cause this bug? I believe core-js is written in ES3, so babel shouldn't have anything to compile |
@JakeChampion in this case, it's |
Unfortunately in my case I don't believe the problem is The only things that have changed in my project are: Package.jsonFrom: "dependencies": {
"@babel/polyfill": "^7.2.5"
},
"devDependencies": {
"@babel/core": "^7.3.4",
"@babel/plugin-syntax-dynamic-import": "^7.2.0",
"@babel/preset-env": "^7.3.4",
"@babel/register": "^7.0.0"
} To: "dependencies": {
"core-js": "3",
"regenerator-runtime": "^0.13.2"
},
"devDependencies": {
"@babel/core": "^7.4.0",
"@babel/plugin-syntax-dynamic-import": "^7.2.0",
"@babel/preset-env": "^7.4.2",
"@babel/register": "^7.4.0"
} Vendor importFrom: import '@babel/polyfill'; to: import 'core-js/stable';
import 'regenerator-runtime/runtime'; Babel configFrom: module.exports = {
presets: [
['@babel/preset-env', {
useBuiltIns: 'entry',
include: [
'es7.promise.finally'
]
}]
],
plugins: [
'@babel/plugin-syntax-dynamic-import'
]
}; to: module.exports = {
presets: [
['@babel/preset-env', {
useBuiltIns: 'entry',
corejs: 3
}]
],
plugins: [
'@babel/plugin-syntax-dynamic-import'
]
}; For reference my
and my webpack babel rule is: {
test: /\.js$/,
loader: 'babel-loader',
exclude: file => /node_modules\/(?!@myCompany)/.test(file) && !/\.vue\.js/.test(file)
} Perhaps I have an incorrect configuration somewhere or have missed something crucial? |
You are explicitly not excluding I suggest using something like this: (assuming that you want to transpile every .js file outside node_modules and only .vue.js files from @mycompany even if in node_modules): {
test: /\.js$/,
loader: "babel-loader",
exclude: {
test: /node_modules/,
not: [
/@myCompany.*\.vue\.js$/
]
},
} |
Sorry that was something I was just testing. The actual config doesn't have the |
@nicolo-ribaudo Thanks, I'll give that a go. |
That is the same as your edited regexp, without core-js 😛 |
I don't see why this was closed. This continues to happen. I can confirm, using the same settings op had. In ie version: 11.0.9600.19301 |
@mihaisavezi because it's not a |
To provide some of the requested information in textual form and potentially help other searchers find this... Stacktrace:
The function throwing the exception is: var getterFor = function getterFor(TYPE) {
return function (it) {
var state;
if (!isObject(it) || (state = get(it)).type !== TYPE) {
throw TypeError('Incompatible receiver, ' + TYPE + ' required');
}
return state;
};
}; |
We are also experiencing this, but our webpack configuration appears to not be transpiling node_modules at all: { test: /\.(js|jsx|mjs)?(\.erb)?$/,
include: [ '...snip.../app/javascript' ],
exclude: /node_modules/,
use: [ { loader: 'babel-loader', options: [Object] } ] } Is there a specific part of the processed output of corejs I can look at to determine if it has had some transformation performed on it? This would let be rule in/out some misconfiguration somewhere. |
Ah, apologies, I see now that the existing solution works for me — I was unaware that the Sorry for the noise! |
@shepmaster I did a PR to webpacker to fix that behavior, hope it'll get merged soon rails/webpacker#2031 |
I tried a solution like
with latest core-js 3.0.1, babel 7 and webpack 4 but the error keeps happening. 😭 |
With that regex, you're excluding all of your node_modules except core-js. |
version 3 has this error. https://github.com/zloirock/core-js#babelpolyfill
set config: const rules = [
{
test: /\.js$/,
use: [
{
loader: 'babel-loader',
options: {
presets: [
[
'@babel/preset-env',
{
useBuiltIns: 'entry',
corejs: 2
}
]
]
}
}
]
}
]; and replace import 'core-js';
import 'regenerator-runtime/runtime'; (ver 2.6.5 does not have |
@yuma84 why just not configure your transpiler correctly, as explained above? -) |
Hey. Following up with this issue, here's my idea of a reliable, cross-platform exclusion of const isPathInside = require('is-path-inside')
const pkgDir = require('pkg-dir')
const coreJsDir = pkgDir.sync(require.resolve('core-js'))
module.exports = {
module: {
rules: [
{
test: /\.m?js$/,
exclude: (input) => isPathInside(input, coreJsDir),
use: { loader: 'babel-loader' }
}
]
}
} Further, this seems like it should be a default exclusion, doesn't it? I mean—no-one would ever wanna transpile To which package(s) should I suggest/request/make a PR for this to be a default exclusion? So many packages 😕. |
I fixed it by changing my babel-loader for node_modules to {
test: /\.(js|jsx)$/,
exclude: /@babel(?:\/|\\{1,2})runtime|core-js/,
use: {
loader: 'babel-loader',
options: {
babelrc: false,
configFile: path.resolve(__dirname, 'babel.config.js'),
compact: false,
cacheDirectory: true,
sourceMaps: false,
},
},
}, Notice the |
-Add core-js@3 as a dependency -Add preset-env configurations for core-js in es5 build config -Keep webpack from transpiling core-js and babel libraries (see zloirock/core-js#514 )
Thank you, this Helped me with pwa-starter-kit migration to core-js3 <3 |
Running into the exact same issue: Stack trace:
|
Fixed it. It was due to the I removed |
@Tarpsvo I started troubleshooting this very issue 4 hours ago and a colleague just pointed out your comment to me, which finally fixed it! So thank you! |
@Tarpsvo ...and how are you importing Could you please share the relevant part of your webpack file? Thanks |
|
For those, coming here in the future. I have a multipage PHP app, and JS ES6 modules, this a setup that works: babel
webpack
|
@Clemzd |
@zloirock Ty for your answer. I get this error with |
@Clemzd sorry, but in this case, it's not enough, I don't see any obvious problems. If you will be able to add a reproducible example, please, open a new issue. This issue is absolutely unrelated. |
core-js version 3 + this code
cause
Exception thrown and not caught
in IE11 pointing to this line: https://github.com/zloirock/core-js/blob/master/packages/core-js/internals/internal-state.js#L18debugging shows that
isObject(it)
part isfalse
.Webpack output
Would be happy to provide more info if needed!
The text was updated successfully, but these errors were encountered: