Support Webpack5
fossamagna opened this issue · comments
MURAKAMI Masahiko commented
Amit Agarwal commented
MURAKAMI Masahiko commented
@labnol
You can tell webpack what kind of ES-features may be used in the generated runtime-code with output.environment
.
Example webpack.config.js for project using DEPRECATED_ES5
as the runtime:
module.exports = {
mode: 'production',
entry: "./main.js",
output: {
path: __dirname + "/output",
filename: "bundle.js",
environment: {
// The environment supports arrow functions ('() => { ... }').
arrowFunction: false,
// The environment supports BigInt as literal (123n).
bigIntLiteral: false,
// The environment supports const and let for variable declarations.
const: false,
// The environment supports destructuring ('{ a, b } = obj').
destructuring: false,
// The environment supports an async import() function to import EcmaScript modules.
dynamicImport: false,
// The environment supports 'for of' iteration ('for (const x of array) { ... }').
forOf: false,
// The environment supports ECMAScript Module syntax to import ECMAScript modules (import ... from '...').
module: false,
}
},
plugins: [
new GasPlugin({ autoGlobalExportsFiles: ["./main.js"] })
],
optimization: {
minimize: true,
}
};
Please see for detail https://webpack.js.org/configuration/output/#outputenvironment.
Amit Agarwal commented
Thank you. You are a star!