mirror of https://github.com/webpack/webpack.git
add test case
This commit is contained in:
parent
da6fe93982
commit
2b210f98fa
|
|
@ -413,7 +413,11 @@ const describeCases = config => {
|
|||
module in testConfig.modules
|
||||
) {
|
||||
return testConfig.modules[module];
|
||||
} else return require(module);
|
||||
} else {
|
||||
return require(module.startsWith("node:")
|
||||
? module.slice(5)
|
||||
: module);
|
||||
}
|
||||
};
|
||||
|
||||
results.push(
|
||||
|
|
|
|||
|
|
@ -0,0 +1,8 @@
|
|||
import vm1 from "vm";
|
||||
import vm2 from "node:vm";
|
||||
|
||||
it("should allow importing node builtin modules with the node: prefix", () => {
|
||||
expect(require("node:fs")).toBe(require("fs"));
|
||||
expect(require("node:path")).toBe(require("path"));
|
||||
expect(vm2).toBe(vm1);
|
||||
});
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
/** @type {import("../../../../").Configuration} */
|
||||
module.exports = {
|
||||
target: "node"
|
||||
};
|
||||
Loading…
Reference in New Issue