mirror of https://github.com/webpack/webpack.git
test: fix
This commit is contained in:
parent
627773bb69
commit
71ea450287
|
@ -184,7 +184,7 @@ class CssLoadingRuntimeModule extends RuntimeModule {
|
|||
)};`
|
||||
: "// data-webpack is not used as build has no uniqueName",
|
||||
`var loadCssChunkData = ${runtimeTemplate.basicFunction(
|
||||
"target, link, chunkId",
|
||||
"target, chunkId",
|
||||
[
|
||||
`${withHmr ? "var moduleIds = [];" : ""}`,
|
||||
`${
|
||||
|
@ -299,7 +299,7 @@ class CssLoadingRuntimeModule extends RuntimeModule {
|
|||
]),
|
||||
"} else {",
|
||||
Template.indent([
|
||||
`loadCssChunkData(${RuntimeGlobals.moduleFactories}, link, chunkId);`,
|
||||
`loadCssChunkData(${RuntimeGlobals.moduleFactories}, chunkId);`,
|
||||
"installedChunkData[0]();"
|
||||
]),
|
||||
"}"
|
||||
|
@ -426,7 +426,7 @@ class CssLoadingRuntimeModule extends RuntimeModule {
|
|||
"while(newTags.length) {",
|
||||
Template.indent([
|
||||
"var info = newTags.pop();",
|
||||
`var chunkModuleIds = loadCssChunkData(${RuntimeGlobals.moduleFactories}, info[1], info[0]);`,
|
||||
`var chunkModuleIds = loadCssChunkData(${RuntimeGlobals.moduleFactories}, info[0]);`,
|
||||
`chunkModuleIds.forEach(${runtimeTemplate.expressionFunction(
|
||||
"moduleIds.push(id)",
|
||||
"id"
|
||||
|
@ -474,7 +474,7 @@ class CssLoadingRuntimeModule extends RuntimeModule {
|
|||
Template.indent([
|
||||
"try { if(cssTextKey(oldTag) == cssTextKey(link)) { if(link.parentNode) link.parentNode.removeChild(link); return resolve(); } } catch(e) {}",
|
||||
"var factories = {};",
|
||||
"loadCssChunkData(factories, link, chunkId);",
|
||||
"loadCssChunkData(factories, chunkId);",
|
||||
`Object.keys(factories).forEach(${runtimeTemplate.expressionFunction(
|
||||
"updatedModulesList.push(id)",
|
||||
"id"
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
module.exports = {
|
||||
findBundle: function (i, options) {
|
||||
return ["style_css.bundle0.js", "bundle0.js"];
|
||||
}
|
||||
};
|
|
@ -0,0 +1,5 @@
|
|||
module.exports = {
|
||||
findBundle: function (i, options) {
|
||||
return ["style2_css.bundle0.mjs", "bundle0.mjs"];
|
||||
}
|
||||
};
|
|
@ -1,8 +1,5 @@
|
|||
module.exports = {
|
||||
moduleScope(scope) {
|
||||
const link = scope.window.document.createElement("link");
|
||||
link.rel = "stylesheet";
|
||||
link.href = "bundle0.css";
|
||||
scope.window.document.head.appendChild(link);
|
||||
findBundle: function (i, options) {
|
||||
return ["style2_css.bundle0.mjs", "bundle0.mjs"];
|
||||
}
|
||||
};
|
||||
|
|
|
@ -1,4 +1,7 @@
|
|||
module.exports = {
|
||||
findBundle: function (i, options) {
|
||||
return ["style2_css.bundle0.js", "bundle0.js"];
|
||||
},
|
||||
moduleScope(scope) {
|
||||
const link = scope.window.document.createElement("link");
|
||||
link.rel = "stylesheet";
|
||||
|
|
|
@ -1,4 +1,7 @@
|
|||
module.exports = {
|
||||
findBundle: function (i, options) {
|
||||
return ["style2_css.bundle0.js", "bundle0.js"];
|
||||
},
|
||||
moduleScope(scope) {
|
||||
const link = scope.window.document.createElement("link");
|
||||
link.rel = "stylesheet";
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
module.exports = {
|
||||
findBundle: function (i, options) {
|
||||
return ["css.bundle0.js", "lazy4_js.bundle0.js", "bundle0.js"];
|
||||
}
|
||||
};
|
|
@ -1,49 +0,0 @@
|
|||
const fs = require("fs");
|
||||
|
||||
let cssBundle;
|
||||
|
||||
module.exports = {
|
||||
findBundle: function (_, options) {
|
||||
const jsBundleRegex = new RegExp(/^bundle\..+\.js$/, "i");
|
||||
const cssBundleRegex = new RegExp(/^bundle\..+\.css$/, "i");
|
||||
const asyncRegex = new RegExp(/^async\..+\.js$/, "i");
|
||||
const files = fs.readdirSync(options.output.path);
|
||||
const jsBundle = files.find(file => jsBundleRegex.test(file));
|
||||
|
||||
if (!jsBundle) {
|
||||
throw new Error(
|
||||
`No file found with correct name (regex: ${
|
||||
jsBundleRegex.source
|
||||
}, files: ${files.join(", ")})`
|
||||
);
|
||||
}
|
||||
|
||||
const async = files.find(file => asyncRegex.test(file));
|
||||
|
||||
if (!async) {
|
||||
throw new Error(
|
||||
`No file found with correct name (regex: ${
|
||||
asyncRegex.source
|
||||
}, files: ${files.join(", ")})`
|
||||
);
|
||||
}
|
||||
|
||||
cssBundle = files.find(file => cssBundleRegex.test(file));
|
||||
|
||||
if (!cssBundle) {
|
||||
throw new Error(
|
||||
`No file found with correct name (regex: ${
|
||||
cssBundleRegex.source
|
||||
}, files: ${files.join(", ")})`
|
||||
);
|
||||
}
|
||||
|
||||
return [jsBundle, async];
|
||||
},
|
||||
moduleScope(scope) {
|
||||
const link = scope.window.document.createElement("link");
|
||||
link.rel = "stylesheet";
|
||||
link.href = cssBundle;
|
||||
scope.window.document.head.appendChild(link);
|
||||
}
|
||||
};
|
|
@ -0,0 +1,13 @@
|
|||
module.exports = {
|
||||
findBundle: function (i, options) {
|
||||
return [
|
||||
`style_module_css_as-is.bundle${i}.js`,
|
||||
`style_module_css_camel-case.bundle${i}.js`,
|
||||
`style_module_css_camel-case-only.bundle${i}.js`,
|
||||
`style_module_css_dashes.bundle${i}.js`,
|
||||
`style_module_css_dashes-only.bundle${i}.js`,
|
||||
`style_module_css_upper.bundle${i}.js`,
|
||||
`bundle${i}.js`
|
||||
];
|
||||
}
|
||||
};
|
|
@ -0,0 +1,10 @@
|
|||
module.exports = {
|
||||
findBundle: function (i, options) {
|
||||
return [
|
||||
"pseudo-export_style_module_css.bundle0.js",
|
||||
"pseudo-export_style_module_css_module.bundle0.js",
|
||||
"pseudo-export_style_module_css_exportsOnly.bundle0.js",
|
||||
"bundle0.js"
|
||||
];
|
||||
}
|
||||
};
|
|
@ -0,0 +1,5 @@
|
|||
module.exports = {
|
||||
findBundle: function (i, options) {
|
||||
return ["125.bundle0.js", "bundle0.js"];
|
||||
}
|
||||
};
|
|
@ -0,0 +1,15 @@
|
|||
module.exports = {
|
||||
findBundle: function (i, options) {
|
||||
return [
|
||||
`style_module_css.bundle${i}.js`,
|
||||
`style_module_css_hash.bundle${i}.js`,
|
||||
`style_module_css_hash-local.bundle${i}.js`,
|
||||
`style_module_css_path-name-local.bundle${i}.js`,
|
||||
`style_module_css_file-local.bundle${i}.js`,
|
||||
`style_module_css_q_f.bundle${i}.js`,
|
||||
`style_module_css_uniqueName-id-contenthash.bundle${i}.js`,
|
||||
`style_module_less.bundle${i}.js`,
|
||||
`bundle${i}.js`
|
||||
];
|
||||
}
|
||||
};
|
|
@ -1,4 +1,7 @@
|
|||
module.exports = {
|
||||
findBundle: function (i, options) {
|
||||
return ["reexport_modules_css.bundle0.js", "bundle0.js"];
|
||||
},
|
||||
moduleScope(scope) {
|
||||
const link = scope.window.document.createElement("link");
|
||||
link.rel = "stylesheet";
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
module.exports = {
|
||||
findBundle: function (i, options) {
|
||||
return [`index_css.bundle${i}.js`, `bundle${i}.js`];
|
||||
}
|
||||
};
|
Loading…
Reference in New Issue