mirror of https://github.com/webpack/webpack.git
fix: increase parallelism when using `importModule` on the execution stage
This commit is contained in:
commit
ce179d77c5
|
|
@ -197,6 +197,7 @@ class LoaderPlugin {
|
|||
if (!referencedModule) {
|
||||
return callback(new Error("Cannot load the module"));
|
||||
}
|
||||
compilation.buildQueue.increaseParallelism();
|
||||
compilation.executeModule(
|
||||
referencedModule,
|
||||
{
|
||||
|
|
@ -206,6 +207,7 @@ class LoaderPlugin {
|
|||
}
|
||||
},
|
||||
(err, result) => {
|
||||
compilation.buildQueue.decreaseParallelism();
|
||||
if (err) return callback(err);
|
||||
const {
|
||||
fileDependencies,
|
||||
|
|
|
|||
|
|
@ -1,3 +0,0 @@
|
|||
module.exports = function (config) {
|
||||
return !/^v(4|6)/.test(process.version);
|
||||
};
|
||||
|
|
@ -1,3 +0,0 @@
|
|||
module.exports = function (config) {
|
||||
return !/^v(4|6)/.test(process.version);
|
||||
};
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
import * as styles from './style.module.css';
|
||||
import * as styles1 from './module.js';
|
||||
|
||||
it("should not deadlock when using importModule", () => {
|
||||
expect(styles.someBottom).toBe("8px");
|
||||
expect(styles1.someBottom).toBe("8px");
|
||||
});
|
||||
|
|
@ -0,0 +1 @@
|
|||
@value someBottom from "./vars.module.css";
|
||||
|
|
@ -0,0 +1,21 @@
|
|||
/** @type {import("../../../../").LoaderDefinition} */
|
||||
module.exports.pitch = function (request) {
|
||||
const callback = this.async();
|
||||
let finished = false;
|
||||
|
||||
this.importModule(
|
||||
`${this.resourcePath}.webpack[javascript/auto]!=!!!${request}`,
|
||||
{},
|
||||
(err, result) => {
|
||||
if (err) return callback(err);
|
||||
if (finished) return;
|
||||
finished = true;
|
||||
callback(null, `module.exports = ${JSON.stringify(result)};`);
|
||||
}
|
||||
);
|
||||
setTimeout(() => {
|
||||
if (finished) return;
|
||||
finished = true;
|
||||
callback(new Error("importModule is hanging"));
|
||||
}, 2000);
|
||||
};
|
||||
|
|
@ -0,0 +1 @@
|
|||
export * from './style1.module.css'
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
@value someBottom from "./inner.module.css";
|
||||
|
||||
.cold {
|
||||
bottom: someBottom;
|
||||
}
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
@value someBottom from "./inner.module.css";
|
||||
|
||||
.cold {
|
||||
bottom: someBottom;
|
||||
}
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
module.exports = function (config) {
|
||||
const [major] = process.versions.node.split(".").map(Number);
|
||||
|
||||
return major >= 18;
|
||||
};
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
@value someBottom: 8px;
|
||||
@value someBottom1: 8px;
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
/** @type {import("../../../../").Configuration} */
|
||||
module.exports = {
|
||||
parallelism: 1,
|
||||
mode: "development",
|
||||
module: {
|
||||
rules: [
|
||||
{
|
||||
test: /\.css$/i,
|
||||
use: [require.resolve("./loader"), "css-loader"]
|
||||
}
|
||||
]
|
||||
}
|
||||
};
|
||||
Loading…
Reference in New Issue