Use Webpack to output es6?

后端 未结 2 2206
梦如初夏
梦如初夏 2021-02-14 10:17

Is there a way to use Webpack to bundle all the JavaScript files and output the resulting bundle.js as an es6 file, and not to es5? So, it is Webpack\'s job to bundle, but is it

2条回答
  •  执念已碎
    2021-02-14 11:08

    webpack 5 can generate both ES5 and ES6/ES2015 code.

    The default configuration will generate ES2015. If you need to support older browsers (like IE11), you can set output.ecmaVersion: 5.

    https://webpack.js.org/migrate/5/#turn-off-es2015-syntax-in-runtime-code-if-necessary

提交回复
热议问题