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

Cannot turn off es5 compile #4948

Closed
disrael opened this issue Sep 1, 2018 · 3 comments
Closed

Cannot turn off es5 compile #4948

disrael opened this issue Sep 1, 2018 · 3 comments

Comments

@disrael
Copy link

disrael commented Sep 1, 2018

In package.json

"browserslist": {
"development": [
"last 1 chrome versions"
],
"production": [
"last 1 chrome versions"
]
},
"devDependencies": {
"enzyme": "^3.5.0",
"react-scripts": "2.0.0-next.a671462c",
"redux-logger": "^3.0.6",
"redux-testkit": "^1.0.6",
"selenium-webdriver": "^4.0.0-alpha.1",
"source-map-explorer": "^1.6.0",
"standard": "^11.0.1"
}

but

(main) disrael@disrael-Lemur:~/dev/uclusion_web_ui$ npm run-script build

[email protected] build /home/disrael/dev/uclusion_web_ui
react-scripts build

Creating an optimized production build...
Failed to compile.

Failed to minify the code from this file:

../javascript_sdk/src/uclusion.js:14 

Read more here: http://bit.ly/2tRViJ9

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] build: react-scripts build
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

Where the error message is pointing to issues compiling to es5.

#4421 was closed but without sufficient documentation to achieve an es6 only compile.

@disrael
Copy link
Author

disrael commented Sep 1, 2018

Looking at https://github.com/facebook/create-react-app/blob/next/packages/react-scripts/config/webpack.config.prod.js isn't the minimizer just hard coded to 5?

optimization: {
minimizer: [
new UglifyJsPlugin({
uglifyOptions: {
parse: {
// we want uglify-js to parse ecma 8 code. However, we don't want it
// to apply any minfication steps that turns valid ecma 5 code
// into invalid ecma 5 code. This is why the 'compress' and 'output'
// sections only apply transformations that are ecma 5 safe
// https://github.com//pull/4234
ecma: 8,
},
compress: {
ecma: 5,
warnings: false,
// Disabled because of an issue with Uglify breaking seemingly valid code:
// https://github.com//issues/2376
// Pending further investigation:
// https://github.com/mishoo/UglifyJS/issues/2011
comparisons: false,
},
mangle: {
safari10: true,
},
output: {
ecma: 5,
comments: false,
// Turned on because emoji and regex is not minified properly using default
// https://github.com//issues/2488
ascii_only: true,
},
},
// Use multi-process parallel running to improve the build speed
// Default number of concurrent runs: os.cpus().length - 1
parallel: true,
// Enable file caching
cache: true,
sourceMap: shouldUseSourceMap,
}),
new OptimizeCSSAssetsPlugin({ cssProcessorOptions: { safe: true } }),
],

@disrael
Copy link
Author

disrael commented Sep 1, 2018

Oh never mind the ecma: 5 hard code because changing it to 6 wouldn't help. I think you have to use https://www.npmjs.com/package/uglify-es instead of UglifyJS.

@Timer
Copy link
Contributor

Timer commented Sep 18, 2018

Hi! Dependencies will be compiled in v2 so this won't be an issue anymore. See #5024, thanks!

@Timer Timer closed this as completed Sep 18, 2018
@lock lock bot locked and limited conversation to collaborators Jan 18, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants