Open samhh opened 7 years ago
In this case we'll need to minify with something new in production, as UglifyJs does not support ES2015 syntax at all. See: https://github.com/imperodesign/generator-impero/blob/master/generators/app/templates/webpack.production.config.js#L26
This will also involve changing the require.ensure() code example to the newer System.import(), which as far as I can tell is a polyfill of sorts for the stage 2 dynamic import (import()
) proposal: https://github.com/domenic/proposal-dynamic-import (they're aiming for import()
eventually: https://github.com/webpack/webpack/issues/3098)
Okay, so the blocker here is that there isn't actually anything yet fully capable of minifying ES2015 code. See here: https://github.com/webpack/webpack/issues/2545
Otherwise this issue will be smooth sailing.
Once this issue is closed, take another look at: https://github.com/imperodesign/generator-impero/issues/52
Also relevant: https://babeljs.io/blog/2016/08/30/babili
I'd say we should keep transpiling for now. The bigger the audience we can support, the better. The only problem the transpiled code brings is a slightly larger file size.
@MrSlide If anyone needs to target older browsers there is always the legacy option which will keep transpiling ES2015 plus add in a few polyfills. If the modern config is defined as latest Chrome, Firefox, Edge and Safari then with such strong native ES2015 support there's arguably no point to transpiling ES2015 there.
Or better yet (thanks to dotJS for this!): https://github.com/babel/babel-preset-env
Also: https://babeljs.io/docs/plugins/preset-latest/
Seems like es2017 preset perhaps only includes the finalised stuff? Unsure. Needs more research.
See also: #35
Worth trying babili via https://github.com/boopathi/babili-webpack-plugin.
Webpack still the blocker on this: https://github.com/webpack/webpack/issues/2545
Looks like modern browsers now have nearly perfect ES2015/ES6 support, so we could remove the ES2015 preset from Babel for modern browsers?
See: http://kangax.github.io/compat-table/es6/