mirror of https://github.com/webpack/webpack.git
Compare commits
3 Commits
c1cb82f508
...
15fc825577
Author | SHA1 | Date |
---|---|---|
|
15fc825577 | |
|
d7f8858c59 | |
|
0ab1f923ba |
|
@ -214,7 +214,7 @@ jobs:
|
|||
|
||||
# Install old `jest` version and deps for legacy node versions
|
||||
- run: |
|
||||
yarn upgrade jest@^27.5.0 jest-circus@^27.5.0 jest-cli@^27.5.0 jest-diff@^27.5.0 jest-environment-node@^27.5.0 jest-junit@^13.0.0 @types/jest@^27.4.0 pretty-format@^27.0.2 husky@^8.0.3 lint-staged@^13.2.1 cspell@^6.31.1 open-cli@^7.2.0 coffee-loader@^1.0.0 babel-loader@^8.1.0 style-loader@^2.0.0 css-loader@^5.0.1 less-loader@^8.1.1 mini-css-extract-plugin@^1.6.1 nyc@^15.1.0 memfs@4.14.0 --ignore-engines
|
||||
yarn upgrade jest@^27.5.0 jest-circus@^27.5.0 jest-cli@^27.5.0 jest-diff@^27.5.0 jest-environment-node@^27.5.0 jest-junit@^13.0.0 @types/jest@^27.4.0 pretty-format@^27.0.2 husky@^8.0.3 lint-staged@^13.2.1 cspell@^6.31.1 open-cli@^7.2.0 coffee-loader@^1.0.0 babel-loader@^8.1.0 style-loader@^2.0.0 css-loader@^5.0.1 less-loader@^8.1.1 mini-css-extract-plugin@^1.6.1 nyc@^15.1.0 --ignore-engines
|
||||
yarn --frozen-lockfile --ignore-engines
|
||||
if: matrix.node-version == '10.x' || matrix.node-version == '12.x' || matrix.node-version == '14.x'
|
||||
|
||||
|
|
|
@ -15,46 +15,59 @@ const browserslist = require("browserslist");
|
|||
// [[C:]/path/to/config][:env]
|
||||
const inputRx = /^(?:((?:[A-Z]:)?[/\\].*?))?(?::(.+?))?$/i;
|
||||
|
||||
/**
|
||||
* @typedef {object} BrowserslistHandlerConfig
|
||||
* @property {string=} configPath
|
||||
* @property {string=} env
|
||||
* @property {string=} query
|
||||
*/
|
||||
|
||||
/**
|
||||
* @param {string | null | undefined} input input string
|
||||
* @param {string} context the context directory
|
||||
* @returns {BrowserslistHandlerConfig} config
|
||||
*/
|
||||
const parse = (input, context) => {
|
||||
if (!input) {
|
||||
return {};
|
||||
}
|
||||
|
||||
if (path.isAbsolute(input)) {
|
||||
const [, configPath, env] = inputRx.exec(input) || [];
|
||||
return { configPath, env };
|
||||
}
|
||||
|
||||
const config = browserslist.findConfig(context);
|
||||
|
||||
if (config && Object.keys(config).includes(input)) {
|
||||
return { env: input };
|
||||
}
|
||||
|
||||
return { query: input };
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {string | null | undefined} input input string
|
||||
* @param {string} context the context directory
|
||||
* @returns {string[] | undefined} selected browsers
|
||||
*/
|
||||
const load = (input, context) => {
|
||||
// browserslist:path-to-config
|
||||
// browserslist:path-to-config:env
|
||||
if (input && path.isAbsolute(input)) {
|
||||
const [, configPath, env] = inputRx.exec(input) || [];
|
||||
const { configPath, env, query } = parse(input, context);
|
||||
|
||||
const config = browserslist.loadConfig({
|
||||
config: configPath,
|
||||
env
|
||||
});
|
||||
// if a query is specified, then use it, else
|
||||
// if a path to a config is specified then load it, else
|
||||
// find a nearest config
|
||||
const config =
|
||||
query ||
|
||||
(configPath
|
||||
? browserslist.loadConfig({
|
||||
config: configPath,
|
||||
env
|
||||
})
|
||||
: browserslist.loadConfig({ path: context, env }));
|
||||
|
||||
return browserslist(config, { env });
|
||||
}
|
||||
|
||||
const env = input || undefined;
|
||||
|
||||
const config = browserslist.loadConfig({
|
||||
path: context,
|
||||
env
|
||||
});
|
||||
|
||||
// browserslist
|
||||
// browserslist:env
|
||||
if (config) {
|
||||
try {
|
||||
return browserslist(config, { env, throwOnMissing: true });
|
||||
} catch (_err) {
|
||||
// Nothing, no `env` was found in browserslist, maybe input is `queries`
|
||||
}
|
||||
}
|
||||
|
||||
// browserslist:query
|
||||
if (env) {
|
||||
return browserslist(env);
|
||||
}
|
||||
if (!config) return;
|
||||
return browserslist(config);
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
@ -1326,13 +1326,8 @@ const applyOutputDefaults = (
|
|||
if (tp.importScripts) return "array-push";
|
||||
throw new Error(
|
||||
"For the selected environment is no default script chunk format available:\n" +
|
||||
`${
|
||||
tp.module
|
||||
? "Module ('module') can be chosen when ES modules are available (please set 'experiments.outputModule' and 'output.module' to `true`)"
|
||||
: ""
|
||||
}\n` +
|
||||
"JSONP Array push ('array-push') can be chosen when 'document' or 'importScripts' is available.\n" +
|
||||
`CommonJs exports ('commonjs') can be chosen when 'require' or node builtins are available.\n${
|
||||
"JSONP Array push can be chosen when 'document' or 'importScripts' is available.\n" +
|
||||
`CommonJs exports can be chosen when 'require' or node builtins are available.\n${
|
||||
helpMessage
|
||||
}`
|
||||
);
|
||||
|
|
|
@ -16,7 +16,7 @@ const getBrowserslistTargetHandler = memoize(() =>
|
|||
* @returns {string} default target
|
||||
*/
|
||||
const getDefaultTarget = (context) => {
|
||||
const browsers = getBrowserslistTargetHandler().load(undefined, context);
|
||||
const browsers = getBrowserslistTargetHandler().load(null, context);
|
||||
return browsers ? "browserslist" : "web";
|
||||
};
|
||||
|
||||
|
|
|
@ -115,7 +115,7 @@ class ImportMetaPlugin {
|
|||
new ModuleDependencyWarning(
|
||||
parser.state.module,
|
||||
new CriticalDependencyWarning(
|
||||
"'import.meta' cannot be used as a standalone expression. For static analysis, its properties must be accessed directly (e.g., 'import.meta.url') or through destructuring."
|
||||
"Accessing import.meta directly is unsupported (only property access or destructuring is supported)"
|
||||
),
|
||||
/** @type {DependencyLocation} */ (metaProperty.loc)
|
||||
)
|
||||
|
|
28
package.json
28
package.json
|
@ -89,7 +89,7 @@
|
|||
"@webassemblyjs/wasm-parser": "^1.14.1",
|
||||
"acorn": "^8.15.0",
|
||||
"acorn-import-phases": "^1.0.3",
|
||||
"browserslist": "^4.26.3",
|
||||
"browserslist": "^4.24.5",
|
||||
"chrome-trace-event": "^1.0.2",
|
||||
"enhanced-resolve": "^5.17.3",
|
||||
"es-module-lexer": "^1.2.1",
|
||||
|
@ -110,17 +110,17 @@
|
|||
"devDependencies": {
|
||||
"@babel/core": "^7.27.1",
|
||||
"@babel/preset-react": "^7.27.1",
|
||||
"@codspeed/core": "^4.0.1",
|
||||
"@eslint/js": "^9.36.0",
|
||||
"@eslint/markdown": "^7.3.0",
|
||||
"@stylistic/eslint-plugin": "^5.4.0",
|
||||
"@codspeed/core": "^5.0.0",
|
||||
"@eslint/js": "^9.29.0",
|
||||
"@eslint/markdown": "^7.1.0",
|
||||
"@stylistic/eslint-plugin": "^5.2.2",
|
||||
"@types/glob-to-regexp": "^0.4.4",
|
||||
"@types/graceful-fs": "^4.1.9",
|
||||
"@types/jest": "^30.0.0",
|
||||
"@types/mime-types": "^2.1.4",
|
||||
"@types/node": "^24.5.2",
|
||||
"@types/node": "^24.1.0",
|
||||
"@types/xxhashjs": "^0.2.4",
|
||||
"assemblyscript": "^0.28.8",
|
||||
"assemblyscript": "^0.28.5",
|
||||
"babel-loader": "^10.0.0",
|
||||
"bundle-loader": "^0.5.6",
|
||||
"coffee-loader": "^5.0.0",
|
||||
|
@ -131,13 +131,13 @@
|
|||
"date-fns": "^4.0.0",
|
||||
"es5-ext": "^0.10.53",
|
||||
"es6-promise-polyfill": "^1.2.0",
|
||||
"eslint": "^9.36.0",
|
||||
"eslint": "^9.29.0",
|
||||
"eslint-config-prettier": "^10.1.1",
|
||||
"eslint-config-webpack": "^4.5.1",
|
||||
"eslint-plugin-import": "^2.32.0",
|
||||
"eslint-plugin-jest": "^29.0.1",
|
||||
"eslint-plugin-jsdoc": "^51.2.3",
|
||||
"eslint-plugin-n": "^17.23.1",
|
||||
"eslint-plugin-n": "^17.21.0",
|
||||
"eslint-plugin-prettier": "^5.5.0",
|
||||
"eslint-plugin-unicorn": "^61.0.1",
|
||||
"file-loader": "^6.0.0",
|
||||
|
@ -146,11 +146,11 @@
|
|||
"hash-wasm": "^4.9.0",
|
||||
"husky": "^9.0.11",
|
||||
"istanbul": "^0.4.5",
|
||||
"jest": "^30.2.0",
|
||||
"jest-circus": "^30.2.0",
|
||||
"jest-cli": "^30.2.0",
|
||||
"jest-diff": "^30.2.0",
|
||||
"jest-environment-node": "^30.2.0",
|
||||
"jest": "^30.1.2",
|
||||
"jest-circus": "^30.1.2",
|
||||
"jest-cli": "^30.1.2",
|
||||
"jest-diff": "^30.1.2",
|
||||
"jest-environment-node": "^30.1.2",
|
||||
"jest-junit": "^16.0.0",
|
||||
"json-loader": "^0.5.7",
|
||||
"json5": "^2.1.3",
|
||||
|
|
|
@ -489,59 +489,6 @@ const withCodSpeed = async (/** @type {import("tinybench").Bench} */ bench) => {
|
|||
return result;
|
||||
};
|
||||
|
||||
function printStatus(fn) {
|
||||
const status = eval("%GetOptimizationStatus(fn)");
|
||||
console.log(status.toString(2).padStart(12, "0"));
|
||||
|
||||
if (status & (1 << 0)) {
|
||||
console.log("is function");
|
||||
}
|
||||
|
||||
if (status & (1 << 1)) {
|
||||
console.log("is never optimized");
|
||||
}
|
||||
|
||||
if (status & (1 << 2)) {
|
||||
console.log("is always optimized");
|
||||
}
|
||||
|
||||
if (status & (1 << 3)) {
|
||||
console.log("is maybe deoptimized");
|
||||
}
|
||||
|
||||
if (status & (1 << 4)) {
|
||||
console.log("is optimized");
|
||||
}
|
||||
|
||||
if (status & (1 << 5)) {
|
||||
console.log("is optimized by TurboFan");
|
||||
}
|
||||
|
||||
if (status & (1 << 6)) {
|
||||
console.log("is interpreted");
|
||||
}
|
||||
|
||||
if (status & (1 << 7)) {
|
||||
console.log("is marked for optimization");
|
||||
}
|
||||
|
||||
if (status & (1 << 8)) {
|
||||
console.log("is marked for concurrent optimization");
|
||||
}
|
||||
|
||||
if (status & (1 << 9)) {
|
||||
console.log("is optimizing concurrently");
|
||||
}
|
||||
|
||||
if (status & (1 << 10)) {
|
||||
console.log("is executing");
|
||||
}
|
||||
|
||||
if (status & (1 << 11)) {
|
||||
console.log("topmost frame is turbo fanned");
|
||||
}
|
||||
}
|
||||
|
||||
const runTaskAsync = async (task, uri) => {
|
||||
const { fnOpts, fn } = task;
|
||||
|
||||
|
@ -556,15 +503,11 @@ const withCodSpeed = async (/** @type {import("tinybench").Bench} */ bench) => {
|
|||
samples.push(await iterationAsync(task));
|
||||
}
|
||||
|
||||
const toRun = async () => {
|
||||
await optimizeFunction(async () => {
|
||||
await fnOpts?.beforeEach?.call(task, "run");
|
||||
await fn();
|
||||
await fnOpts?.afterEach?.call(task, "run");
|
||||
};
|
||||
|
||||
await optimizeFunction(toRun);
|
||||
|
||||
console.log("optimize", printStatus(toRun));
|
||||
});
|
||||
|
||||
await fnOpts?.beforeEach?.call(task, "run");
|
||||
await mongoMeasurement.start(uri);
|
||||
|
@ -661,7 +604,7 @@ const withCodSpeed = async (/** @type {import("tinybench").Bench} */ bench) => {
|
|||
return finalizeSyncRun();
|
||||
};
|
||||
} else if (codspeedRunnerMode === "walltime") {
|
||||
// We don't need it
|
||||
// TODO
|
||||
}
|
||||
|
||||
return bench;
|
||||
|
|
|
@ -1,7 +1,3 @@
|
|||
"use strict";
|
||||
|
||||
module.exports = [
|
||||
[
|
||||
/Critical dependency: 'import\.meta' cannot be used as a standalone expression\. For static analysis, its properties must be accessed directly \(e\.g\., 'import\.meta\.url'\) or through destructuring\./
|
||||
]
|
||||
];
|
||||
module.exports = [[/Critical dependency: Accessing import\.meta/]];
|
||||
|
|
|
@ -2,6 +2,6 @@
|
|||
|
||||
module.exports = [
|
||||
[
|
||||
/'import\.meta' cannot be used as a standalone expression\. For static analysis, its properties must be accessed directly \(e\.g\., 'import\.meta\.url'\) or through destructuring\./
|
||||
/Accessing import.meta directly is unsupported \(only property access or destructuring is supported\)/
|
||||
]
|
||||
];
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
extends browserslist-config-mycompany
|
|
@ -1 +0,0 @@
|
|||
it("should compile and run the test", function() {});
|
|
@ -1,37 +0,0 @@
|
|||
"use strict";
|
||||
|
||||
const fs = require("fs");
|
||||
const path = require("path");
|
||||
|
||||
const rootPath = path.resolve(__dirname, "../../../../");
|
||||
const rootNodeModules = path.resolve(rootPath, "./node_modules");
|
||||
const browserslistPackage = path.resolve(
|
||||
rootNodeModules,
|
||||
"browserslist-config-mycompany"
|
||||
);
|
||||
const content = `
|
||||
module.exports = {
|
||||
development: [
|
||||
'last 1 version'
|
||||
],
|
||||
production: [
|
||||
'ie 9',
|
||||
]
|
||||
}
|
||||
`;
|
||||
const browserslistFile = path.resolve(browserslistPackage, "./index.js");
|
||||
|
||||
try {
|
||||
fs.mkdirSync(browserslistPackage);
|
||||
} catch (_err) {
|
||||
// Nothing
|
||||
}
|
||||
|
||||
fs.writeFileSync(browserslistFile, content);
|
||||
|
||||
module.exports = {
|
||||
afterExecute() {
|
||||
fs.unlinkSync(browserslistFile);
|
||||
fs.rmdirSync(browserslistPackage);
|
||||
}
|
||||
};
|
|
@ -1,43 +0,0 @@
|
|||
"use strict";
|
||||
|
||||
const path = require("path");
|
||||
|
||||
/** @type {import("../../../../").Configuration} */
|
||||
module.exports = {
|
||||
target: `browserslist:${path.join(__dirname, ".browserslistrc")}:production`,
|
||||
plugins: [
|
||||
(compiler) => {
|
||||
compiler.hooks.compilation.tap("Test", (compilation) => {
|
||||
expect(compilation.outputOptions.environment).toMatchInlineSnapshot(`
|
||||
Object {
|
||||
"arrowFunction": false,
|
||||
"asyncFunction": false,
|
||||
"bigIntLiteral": false,
|
||||
"const": false,
|
||||
"destructuring": false,
|
||||
"document": true,
|
||||
"dynamicImport": false,
|
||||
"dynamicImportInWorker": false,
|
||||
"forOf": false,
|
||||
"globalThis": false,
|
||||
"module": false,
|
||||
"nodePrefixForCoreModules": false,
|
||||
"optionalChaining": false,
|
||||
"templateLiteral": false,
|
||||
}
|
||||
`);
|
||||
expect(compilation.options.externalsPresets).toMatchInlineSnapshot(`
|
||||
Object {
|
||||
"electron": false,
|
||||
"electronMain": false,
|
||||
"electronPreload": false,
|
||||
"electronRenderer": false,
|
||||
"node": false,
|
||||
"nwjs": false,
|
||||
"web": true,
|
||||
}
|
||||
`);
|
||||
});
|
||||
}
|
||||
]
|
||||
};
|
|
@ -1 +0,0 @@
|
|||
extends browserslist-config-mycompany1
|
|
@ -1 +0,0 @@
|
|||
it("should compile and run the test", function() {});
|
|
@ -1,38 +0,0 @@
|
|||
"use strict";
|
||||
|
||||
const fs = require("fs");
|
||||
const path = require("path");
|
||||
|
||||
const rootPath = path.resolve(__dirname, "../../../../");
|
||||
const rootNodeModules = path.resolve(rootPath, "./node_modules");
|
||||
const browserslistPackage = path.resolve(
|
||||
rootNodeModules,
|
||||
"browserslist-config-mycompany1"
|
||||
);
|
||||
const content = `
|
||||
module.exports = {
|
||||
development: [
|
||||
'last 1 version'
|
||||
],
|
||||
// We are in tests, so 'process.env.NODE_ENV' has the 'test' value (browserslist respects the 'process.env.NODE_ENV' value)
|
||||
test: [
|
||||
'ie 9',
|
||||
]
|
||||
}
|
||||
`;
|
||||
const browserslistFile = path.resolve(browserslistPackage, "./index.js");
|
||||
|
||||
try {
|
||||
fs.mkdirSync(browserslistPackage);
|
||||
} catch (_err) {
|
||||
// Nothing
|
||||
}
|
||||
|
||||
fs.writeFileSync(browserslistFile, content);
|
||||
|
||||
module.exports = {
|
||||
afterExecute() {
|
||||
fs.unlinkSync(browserslistFile);
|
||||
fs.rmdirSync(browserslistPackage);
|
||||
}
|
||||
};
|
|
@ -1,43 +0,0 @@
|
|||
"use strict";
|
||||
|
||||
const path = require("path");
|
||||
|
||||
/** @type {import("../../../../").Configuration} */
|
||||
module.exports = {
|
||||
target: `browserslist:${path.join(__dirname, ".browserslistrc")}`,
|
||||
plugins: [
|
||||
(compiler) => {
|
||||
compiler.hooks.compilation.tap("Test", (compilation) => {
|
||||
expect(compilation.outputOptions.environment).toMatchInlineSnapshot(`
|
||||
Object {
|
||||
"arrowFunction": false,
|
||||
"asyncFunction": false,
|
||||
"bigIntLiteral": false,
|
||||
"const": false,
|
||||
"destructuring": false,
|
||||
"document": true,
|
||||
"dynamicImport": false,
|
||||
"dynamicImportInWorker": false,
|
||||
"forOf": false,
|
||||
"globalThis": false,
|
||||
"module": false,
|
||||
"nodePrefixForCoreModules": false,
|
||||
"optionalChaining": false,
|
||||
"templateLiteral": false,
|
||||
}
|
||||
`);
|
||||
expect(compilation.options.externalsPresets).toMatchInlineSnapshot(`
|
||||
Object {
|
||||
"electron": false,
|
||||
"electronMain": false,
|
||||
"electronPreload": false,
|
||||
"electronRenderer": false,
|
||||
"node": false,
|
||||
"nwjs": false,
|
||||
"web": true,
|
||||
}
|
||||
`);
|
||||
});
|
||||
}
|
||||
]
|
||||
};
|
|
@ -1 +0,0 @@
|
|||
it("should compile and run the test", function() {});
|
|
@ -1,10 +0,0 @@
|
|||
{
|
||||
"browserslist": {
|
||||
"development": [
|
||||
"last 1 version"
|
||||
],
|
||||
"production": [
|
||||
"ie 9"
|
||||
]
|
||||
}
|
||||
}
|
|
@ -1,41 +0,0 @@
|
|||
"use strict";
|
||||
|
||||
/** @type {import("../../../../").Configuration} */
|
||||
module.exports = {
|
||||
target: "browserslist:production",
|
||||
plugins: [
|
||||
(compiler) => {
|
||||
compiler.hooks.compilation.tap("Test", (compilation) => {
|
||||
expect(compilation.outputOptions.environment).toMatchInlineSnapshot(`
|
||||
Object {
|
||||
"arrowFunction": false,
|
||||
"asyncFunction": false,
|
||||
"bigIntLiteral": false,
|
||||
"const": false,
|
||||
"destructuring": false,
|
||||
"document": true,
|
||||
"dynamicImport": false,
|
||||
"dynamicImportInWorker": false,
|
||||
"forOf": false,
|
||||
"globalThis": false,
|
||||
"module": false,
|
||||
"nodePrefixForCoreModules": false,
|
||||
"optionalChaining": false,
|
||||
"templateLiteral": false,
|
||||
}
|
||||
`);
|
||||
expect(compilation.options.externalsPresets).toMatchInlineSnapshot(`
|
||||
Object {
|
||||
"electron": false,
|
||||
"electronMain": false,
|
||||
"electronPreload": false,
|
||||
"electronRenderer": false,
|
||||
"node": false,
|
||||
"nwjs": false,
|
||||
"web": true,
|
||||
}
|
||||
`);
|
||||
});
|
||||
}
|
||||
]
|
||||
};
|
|
@ -1 +0,0 @@
|
|||
it("should compile and run the test", function() {});
|
|
@ -1,5 +0,0 @@
|
|||
{
|
||||
"browserslist": [
|
||||
"extends browserslist-config-mycompany2"
|
||||
]
|
||||
}
|
|
@ -1,38 +0,0 @@
|
|||
"use strict";
|
||||
|
||||
const fs = require("fs");
|
||||
const path = require("path");
|
||||
|
||||
const rootPath = path.resolve(__dirname, "../../../../");
|
||||
const rootNodeModules = path.resolve(rootPath, "./node_modules");
|
||||
const browserslistPackage = path.resolve(
|
||||
rootNodeModules,
|
||||
"browserslist-config-mycompany2"
|
||||
);
|
||||
const content = `
|
||||
module.exports = {
|
||||
development: [
|
||||
'last 1 version'
|
||||
],
|
||||
// We are in tests, so 'process.env.NODE_ENV' has the 'test' value (browserslist respects the 'process.env.NODE_ENV' value)
|
||||
test: [
|
||||
'ie 9',
|
||||
]
|
||||
}
|
||||
`;
|
||||
const browserslistFile = path.resolve(browserslistPackage, "./index.js");
|
||||
|
||||
try {
|
||||
fs.mkdirSync(browserslistPackage);
|
||||
} catch (_err) {
|
||||
// Nothing
|
||||
}
|
||||
|
||||
fs.writeFileSync(browserslistFile, content);
|
||||
|
||||
module.exports = {
|
||||
afterExecute() {
|
||||
fs.unlinkSync(browserslistFile);
|
||||
fs.rmdirSync(browserslistPackage);
|
||||
}
|
||||
};
|
|
@ -1,41 +0,0 @@
|
|||
"use strict";
|
||||
|
||||
/** @type {import("../../../../").Configuration} */
|
||||
module.exports = {
|
||||
target: "browserslist",
|
||||
plugins: [
|
||||
(compiler) => {
|
||||
compiler.hooks.compilation.tap("Test", (compilation) => {
|
||||
expect(compilation.outputOptions.environment).toMatchInlineSnapshot(`
|
||||
Object {
|
||||
"arrowFunction": false,
|
||||
"asyncFunction": false,
|
||||
"bigIntLiteral": false,
|
||||
"const": false,
|
||||
"destructuring": false,
|
||||
"document": true,
|
||||
"dynamicImport": false,
|
||||
"dynamicImportInWorker": false,
|
||||
"forOf": false,
|
||||
"globalThis": false,
|
||||
"module": false,
|
||||
"nodePrefixForCoreModules": false,
|
||||
"optionalChaining": false,
|
||||
"templateLiteral": false,
|
||||
}
|
||||
`);
|
||||
expect(compilation.options.externalsPresets).toMatchInlineSnapshot(`
|
||||
Object {
|
||||
"electron": false,
|
||||
"electronMain": false,
|
||||
"electronPreload": false,
|
||||
"electronRenderer": false,
|
||||
"node": false,
|
||||
"nwjs": false,
|
||||
"web": true,
|
||||
}
|
||||
`);
|
||||
});
|
||||
}
|
||||
]
|
||||
};
|
|
@ -1 +0,0 @@
|
|||
it("should compile and run the test", function() {});
|
|
@ -1,10 +0,0 @@
|
|||
{
|
||||
"browserslist": {
|
||||
"development": [
|
||||
"last 1 version"
|
||||
],
|
||||
"production": [
|
||||
"ie 9"
|
||||
]
|
||||
}
|
||||
}
|
|
@ -1,41 +0,0 @@
|
|||
"use strict";
|
||||
|
||||
/** @type {import("../../../../").Configuration} */
|
||||
module.exports = {
|
||||
target: "browserslist:maintained node versions",
|
||||
plugins: [
|
||||
(compiler) => {
|
||||
compiler.hooks.compilation.tap("Test", (compilation) => {
|
||||
expect(compilation.outputOptions.environment).toMatchInlineSnapshot(`
|
||||
Object {
|
||||
"arrowFunction": true,
|
||||
"asyncFunction": true,
|
||||
"bigIntLiteral": true,
|
||||
"const": true,
|
||||
"destructuring": true,
|
||||
"document": false,
|
||||
"dynamicImport": true,
|
||||
"dynamicImportInWorker": false,
|
||||
"forOf": true,
|
||||
"globalThis": true,
|
||||
"module": true,
|
||||
"nodePrefixForCoreModules": true,
|
||||
"optionalChaining": true,
|
||||
"templateLiteral": true,
|
||||
}
|
||||
`);
|
||||
expect(compilation.options.externalsPresets).toMatchInlineSnapshot(`
|
||||
Object {
|
||||
"electron": false,
|
||||
"electronMain": false,
|
||||
"electronPreload": false,
|
||||
"electronRenderer": false,
|
||||
"node": true,
|
||||
"nwjs": false,
|
||||
"web": false,
|
||||
}
|
||||
`);
|
||||
});
|
||||
}
|
||||
]
|
||||
};
|
Loading…
Reference in New Issue