webpack/test/configCases/ecmaVersion/browserslist/webpack.config.js

42 lines
973 B
JavaScript
Raw Normal View History

"use strict";
2020-09-24 19:33:09 +08:00
/** @type {import("../../../../").Configuration} */
module.exports = {
2020-09-28 16:53:20 +08:00
target: ["browserslist"],
plugins: [
(compiler) => {
compiler.hooks.compilation.tap("Test", (compilation) => {
2020-09-28 16:53:20 +08:00
expect(compilation.outputOptions.environment).toMatchInlineSnapshot(`
Object {
"arrowFunction": true,
2024-01-14 22:37:32 +08:00
"asyncFunction": true,
2020-10-31 03:05:43 +08:00
"bigIntLiteral": true,
2020-09-28 16:53:20 +08:00
"const": true,
"destructuring": true,
2024-03-25 21:07:02 +08:00
"document": false,
2022-02-21 22:22:42 +08:00
"dynamicImport": true,
"dynamicImportInWorker": true,
2020-09-28 16:53:20 +08:00
"forOf": true,
2023-05-30 02:27:48 +08:00
"globalThis": true,
2022-02-21 22:22:42 +08:00
"module": true,
2024-04-12 00:24:59 +08:00
"nodePrefixForCoreModules": true,
2023-05-30 02:27:48 +08:00
"optionalChaining": true,
"templateLiteral": true,
2020-09-28 16:53:20 +08:00
}
`);
expect(compilation.options.externalsPresets).toMatchInlineSnapshot(`
Object {
"electron": false,
"electronMain": false,
"electronPreload": false,
"electronRenderer": false,
"node": true,
"nwjs": false,
"web": false,
}
`);
});
}
]
2020-09-24 19:33:09 +08:00
};