mirror of https://github.com/webpack/webpack.git
fix: bug
This commit is contained in:
parent
98b976e8bf
commit
65d17428da
|
|
@ -1022,9 +1022,9 @@ If changing the source code is not an option there is also a resolve options cal
|
||||||
|
|
||||||
const parsedResult = this._parseResourceWithoutFragment(result);
|
const parsedResult = this._parseResourceWithoutFragment(result);
|
||||||
|
|
||||||
const type = /\.mjs$/i.test(parsedResult.loader)
|
const type = /\.mjs$/i.test(parsedResult.path)
|
||||||
? "module"
|
? "module"
|
||||||
: /\.cjs$/i.test(parsedResult.loader)
|
: /\.cjs$/i.test(parsedResult.path)
|
||||||
? "commonjs"
|
? "commonjs"
|
||||||
: resolveRequest.descriptionFileData === undefined
|
: resolveRequest.descriptionFileData === undefined
|
||||||
? undefined
|
? undefined
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,11 @@
|
||||||
it("should pass package.json type to loader", function () {
|
it("should pass package.json type to loader", function () {
|
||||||
// expect(require("cjs/loader.js!")).toBe("commonjs");
|
expect(require("cjs/loader.js!")).toBe("commonjs");
|
||||||
// expect(require("./loader.js!")).toBe("undefined");
|
expect(require("./loader.js!")).toBe("undefined");
|
||||||
});
|
});
|
||||||
|
|
||||||
it("should pass 'commonjs' type to loader for .cjs", function () {
|
it("should pass 'commonjs' type to loader for .cjs", function () {
|
||||||
// expect(require("cjs/loader.cjs!")).toBe("commonjs");
|
expect(require("cjs/loader.cjs!")).toBe("commonjs");
|
||||||
expect(require("./loader.cjs!")).toBe("undefined");
|
expect(require("./loader.cjs!")).toBe("commonjs");
|
||||||
// TODO need fix in v8 https://github.com/nodejs/node/issues/35889
|
// TODO need fix in v8 https://github.com/nodejs/node/issues/35889
|
||||||
// TODO otherwise this test case cause segment fault
|
// TODO otherwise this test case cause segment fault
|
||||||
// expect(require("esm/loader.cjs!")).toBe("commonjs");
|
// expect(require("esm/loader.cjs!")).toBe("commonjs");
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue