Doc says(https://webpack.js.org/migrate/5/) there is _output.ecmaVersion_ option to make webpack use es5 runtime.
What is the current behavior?
But when I use it I got validation error:
ValidationError: Invalid configuration object. Webpack has been initialized using a configuration object that does not match the API schema.
- configuration.output has an unknown property 'ecmaVersion'. These properties are valid:
If the current behavior is a bug, please provide the steps to reproduce.
npm i webpack@next webpack-cli
webpack.config.js
module.exports = {
mode: 'development',
entry: './in.js',
output: {
ecmaVersion: 5
}
};
in.js may be empty.
npx webpack
What is the expected behavior?
No validation error expected. Build runtime has es5 version(no array functions etc).
Other relevant information:
webpack version: 5.0.0-rc.3
Node.js version: v14.10.1
Operating System: win10 64
in https://github.com/webpack/webpack/releases under v5.0.0-beta.30 it says : "output.ecmaVersion is replaced with output.environment which lists features used by webpack"
However i could not find any documentation for output.environment
At least validation error for environment helps here :)
- configuration.output.environment should be an object:
object { arrowFunction?, bigIntLiteral?, const?, destructuring?, dynamicImport?, forOf?, module? }
on https://github.com/webpack/webpack/releases/tag/v5.0.0-rc.1 : "uses target: "browserslist" as default when a browserslist config has been found, otherwise fallback to target: "web" as usual"
So i tried to remove "targets" from babel.presets, and add browserslist instead, as below, but i dont see any change
` "browserslist": [
"Chrome >= 70",
"FireFox >= 52",
"Safari >= 10",
"IE 11",
"last 4 Edge versions"
],
"babel": {
"presets": [
[
"@babel/preset-env",
{
"useBuiltIns": "usage",
"corejs": {
"version": 3,
"proposals": true
},
"debug": true
}
]
],`
So, probably should be converted to docs issue.
Please use target: ['web', 'es5'], we need to update docs ASAP
/cc @webpack/documentation-team need to solve ASAP
Close in favor https://github.com/webpack/webpack.js.org/issues/4012
Most helpful comment
Please use
target: ['web', 'es5'], we need to update docs ASAP