minify icon indicating copy to clipboard operation
minify copied to clipboard

IE Syntax error on minified code evaluation

Open babel-bot opened this issue 7 years ago • 6 comments
trafficstars

Original issue submitted by @attatrol in https://github.com/babel/babel/issues/8980

Bug Report

Current Behavior IE 11.0.14393.0 returns error Syntax error in regular exception when i try to copy the minified code in its console.

Input Code REPL link

var regexpUnicodeSupport;
function test() { 
try { new RegExp("\uffff", "u"); regexpUnicodeSupport = true; }
  catch(e) {}
}

Expected behavior/code Successful evaluation.

Babel Configuration default minify preset used by REPL

Environment REPL

babel-bot avatar Nov 07 '18 08:11 babel-bot

It's also an issue for core-js: https://github.com/zloirock/core-js/issues/479 https://github.com/babel/babel/issues/9380

zloirock avatar Jan 22 '19 10:01 zloirock

Any updates? I'm still having this problem with:

"@babel/polyfill": "^7.10.4",
"core-js": "^3.6.5",
"next": "^9.3.0",

and

"useBuiltIns": "usage",

LucidityDesign avatar Jul 03 '20 15:07 LucidityDesign

I'm also still having this issue. It's happening in the package object-assign when i inspect the quarrelsome code in IE.... or at least that's the comment above the line to which the error is occurring. I have tried to put in es6-object-assign and use its automatic polyfill at the entry point of the application, but it still produces the same issue. I really need to get this fixed so that my app can move on in development.

I'm currently using (package.json):

   "@babel/plugin-proposal-class-properties": "^7.10.4",
    "@babel/plugin-proposal-object-rest-spread": "^7.11.0",
    "@babel/polyfill": "^7.2.5",
    "@types/react": "^16.4.18",
    "@types/react-dom": "^16.0.9",
    "axios": "^0.18.0",
    "babel-runtime": "^6.26.0",
    "clean-webpack-plugin": "^2.0.1",
    "core-js": "^2.5.7",
    "es6-object-assign": "^1.1.0",
    "handlebars": "^4.1.2",
    "handlebars-loader": "^1.7.1",
    "history": "^4.7.2",
    "html-webpack-plugin": "^3.2.0",
    "node-sass": "^4.9.4",
    "npm": "^6.4.1",
    "raf": "^3.4.0",
    "react": "^16.5.2",
    "react-dom": "^16.5.2",
    "react-html-parser": "^2.0.2",
    "react-router-dom": "^4.3.1",
    "react-spinners": "^0.4.8",
    "rest": "^1.3.1",
    "styled-components": "^5.0.0",
    "util": "^0.12.1"

and in my webpack.config.js (just focusing on babel-loader):

             {
                    test: path.join(__dirname, '.'),
                    exclude: /(node_modules)/,
                    use: [{
                        loader: 'babel-loader?optional=runtime',
                        options: {
                            presets: [
                                [
                                    "@babel/preset-env",
                                    {
                                        useBuiltIns: 'entry',
                                        corejs: '2.5.7',
                                        targets: '> 0.25%, not dead'
                                    }
                                ],
                                "@babel/preset-react"
                            ],
                            plugins: [
                                '@babel/plugin-proposal-class-properties',
                                '@babel/plugin-proposal-object-rest-spread'
                            ]
                        }
                    }]
                }

I can provide as much detail as you need to help figure this out.

LiquidMusic1 avatar Aug 26 '20 12:08 LiquidMusic1

Also having this issue with Vite - when configured using "@vitejs/plugin-legacy" as so:

	plugins: [
		...
		legacy({
			targets: ["defaults, ie >= 11"], // include polyfills from core-js for this set of browsers
			additionalLegacyPolyfills: [
				"proxy-polyfill/proxy.min.js", // immer requires this
			]
		})
	],

IE11 will still not load a react based project, resulting in:

Unhandled promise rejection SyntaxError: Syntax error in regular expression

Not found a work around at the moment, and whilst I will probably just drop IE11 support I would prefer not to uncessarily.

kieranbenton avatar Jan 16 '23 13:01 kieranbenton

@kieranbenton I am also having that same issue when using vite and with that plugin. @kieranbenton were you able to resolve this?

jacob-baehr avatar Oct 24 '23 18:10 jacob-baehr

Afraid not, but equally not tried it again

kieranbenton avatar Oct 24 '23 18:10 kieranbenton