Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ jobs:
yarn --frozen-lockfile
if: matrix.node-version == '18.x'
# Install main version of our deps
- run: yarn upgrade enhanced-resolve@webpack/enhanced-resolve#main loader-runner@webpack/loader-runner#main webpack-sources@webpack/webpack-sources#main watchpack@webpack/watchpack#main tapable@webpack/tapable#master
- run: yarn upgrade enhanced-resolve@webpack/enhanced-resolve#main loader-runner@webpack/loader-runner#main webpack-sources@webpack/webpack-sources#main watchpack@webpack/watchpack#main tapable@webpack/tapable#main
if: matrix.use_main_branches == '1'
# Install dependencies for LTS node versions
- run: yarn --frozen-lockfile
Expand Down
6 changes: 3 additions & 3 deletions lib/esm/ModuleChunkLoadingRuntimeModule.js
Original file line number Diff line number Diff line change
Expand Up @@ -216,9 +216,9 @@ class ModuleChunkLoadingRuntimeModule extends RuntimeModule {
"// setup Promise in chunk cache",
`var promise = ${importFunctionName}(${
compilation.outputOptions.publicPath === "auto"
? ""
: `${RuntimeGlobals.publicPath} + `
}${JSON.stringify(rootOutputDir)} + ${
? JSON.stringify(rootOutputDir)
: RuntimeGlobals.publicPath
} + ${
RuntimeGlobals.getChunkScriptFilename
}(chunkId)).then(installChunk, ${runtimeTemplate.basicFunction(
"e",
Expand Down
19 changes: 10 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -170,17 +170,18 @@
"pretest": "yarn lint",
"test": "node --expose-gc --max-old-space-size=4096 --experimental-vm-modules --trace-deprecation node_modules/jest-cli/bin/jest --logHeapUsage",
"test:update-snapshots": "yarn test -u",
"test:integration": "node --expose-gc --max-old-space-size=4096 --experimental-vm-modules --trace-deprecation node_modules/jest-cli/bin/jest --logHeapUsage --testMatch \"<rootDir>/test/*.{basictest,longtest,test}.js\"",
"test:basic": "node --expose-gc --max-old-space-size=4096 --experimental-vm-modules --trace-deprecation node_modules/jest-cli/bin/jest --logHeapUsage --testMatch \"<rootDir>/test/*.basictest.js\"",
"test:unit": "node --max-old-space-size=4096 --experimental-vm-modules --trace-deprecation node_modules/jest-cli/bin/jest --testMatch \"<rootDir>/test/*.unittest.js\"",
"test:basic": "yarn test --testMatch \"<rootDir>/test/*.basictest.js\"",
"test:unit": "yarn test --testMatch \"<rootDir>/test/*.unittest.js\"",
"test:integration": "yarn test --testMatch \"<rootDir>/test/*.{basictest,longtest,test}.js\"",
"cover": "yarn cover:all && yarn cover:report",
"cover:clean": "rimraf .nyc_output coverage",
"cover:all": "node --expose-gc --max-old-space-size=4096 --experimental-vm-modules node_modules/jest-cli/bin/jest --logHeapUsage --coverage",
"cover:basic": "node --expose-gc --max-old-space-size=4096 --experimental-vm-modules node_modules/jest-cli/bin/jest --logHeapUsage --testMatch \"<rootDir>/test/*.basictest.js\" --coverage",
"cover:integration": "node --expose-gc --max-old-space-size=4096 --experimental-vm-modules node_modules/jest-cli/bin/jest --logHeapUsage --testMatch \"<rootDir>/test/*.{basictest,longtest,test}.js\" --coverage",
"cover:integration:a": "node --expose-gc --max-old-space-size=4096 --experimental-vm-modules node_modules/jest-cli/bin/jest --logHeapUsage --testMatch \"<rootDir>/test/*.{basictest,test}.js\" --coverage",
"cover:integration:b": "node --expose-gc --max-old-space-size=4096 --experimental-vm-modules node_modules/jest-cli/bin/jest --logHeapUsage --testMatch \"<rootDir>/test/*.longtest.js\" --coverage",
"cover:unit": "node --max-old-space-size=4096 --experimental-vm-modules node_modules/jest-cli/bin/jest --testMatch \"<rootDir>/test/*.unittest.js\" --coverage",
"cover:all": "yarn cover:base --coverage",
"cover:unit": "yarn cover:base --testMatch \"<rootDir>/test/*.unittest.js\" --coverage",
"cover:basic": "yarn cover:base --testMatch \"<rootDir>/test/*.basictest.js\" --coverage",
"cover:integration": "yarn cover:base --testMatch \"<rootDir>/test/*.{basictest,longtest,test}.js\" --coverage",
"cover:integration:a": "yarn cover:base --testMatch \"<rootDir>/test/*.{basictest,test}.js\" --coverage",
"cover:integration:b": "yarn cover:base --testMatch \"<rootDir>/test/*.longtest.js\" --coverage",
"cover:base": "node --expose-gc --max-old-space-size=4096 --experimental-vm-modules node_modules/jest-cli/bin/jest --logHeapUsage",
"cover:types": "node node_modules/tooling/type-coverage",
"cover:merge": "yarn mkdirp .nyc_output && nyc merge .nyc_output coverage/coverage-nyc.json && rimraf .nyc_output",
"cover:report": "nyc report --reporter=lcov --reporter=text -t coverage"
Expand Down
4 changes: 4 additions & 0 deletions test/ConfigTestCases.template.js
Original file line number Diff line number Diff line change
Expand Up @@ -498,11 +498,15 @@ const describeCases = config => {
esmMode,
parentModule
) => {
if (testConfig.resolveModule) {
module = testConfig.resolveModule(module, i, options);
}
if (testConfig === undefined) {
throw new Error(
`_require(${module}) called after all tests from ${category.name} ${testName} have completed`
);
}

if (Array.isArray(module) || /^\.\.?\//.test(module)) {
let content;
let p;
Expand Down
29 changes: 28 additions & 1 deletion test/configCases/output-module/public-path/test.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,29 @@
const path = require("path");

module.exports = {
resolveModule(module, i) {
if (/^\.\/bundle/.test(module)) {
return module;
}

if (i === 4 || i === 5) {
return `./${module}`;
}

if (i === 6 || i === 7 || i === 10 || i === 11) {
if (/async/.test(module)) {
return `../${module}`;
}

return `./${module}`;
}

if (i === 15) {
return `./${path.basename(module)}`;
}

return module;
},
findBundle(i, options) {
switch (i) {
case 2:
Expand All @@ -9,8 +34,10 @@ module.exports = {
case 3:
case 7:
case 11:
case 12:
case 13:
case 12: {
case 14:
case 15: {
return `./bundle${i}/${options.output.filename}`;
}
default: {
Expand Down
27 changes: 27 additions & 0 deletions test/configCases/output-module/public-path/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -179,5 +179,32 @@ module.exports = (env, { testPath }) => [
experiments: {
outputModule: true
}
},
{
devtool: false,
target: "web",
output: {
path: path.resolve(testPath, "./bundle14"),
module: true,
filename: "js/bundle14.mjs",
chunkFilename: "js/[id].bundle14.mjs"
},
experiments: {
outputModule: true
}
},
{
devtool: false,
target: "web",
output: {
publicPath: "https://example.com/public/path/",
path: path.resolve(testPath, "./bundle15"),
module: true,
filename: "js/bundle15.mjs",
chunkFilename: "js/[id].bundle15.mjs"
},
experiments: {
outputModule: true
}
}
];
Loading