Use resource path when possible for absoluteResourcePath
Signed-off-by: Louis Chemineau <louis@chmn.me>
This commit is contained in:
parent
ccecc17c01
commit
fdf28b84ed
|
@ -138,7 +138,8 @@ ModuleFilenameHelpers.createFilename = (
|
|||
);
|
||||
identifier = memoize(() => requestShortener.shorten(module.identifier()));
|
||||
moduleId = () => chunkGraph.getModuleId(module);
|
||||
absoluteResourcePath = () => module.identifier().split("!").pop();
|
||||
absoluteResourcePath = () =>
|
||||
requestShortener.shorten(module.nameForCondition());
|
||||
hash = getHash(identifier, hashFunction);
|
||||
}
|
||||
const resource = memoize(() => shortIdentifier().split("!").pop());
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
it("should not include layer or type in absoluteResourcePath", function() {
|
||||
var fs = require("fs");
|
||||
var source = fs.readFileSync(__filename + ".map", "utf-8");
|
||||
var map = JSON.parse(source);
|
||||
expect(map.sources).toContain("webpack:///test.js");
|
||||
});
|
||||
|
||||
if (Math.random() < 0) require("./test.js");
|
|
@ -0,0 +1,3 @@
|
|||
var foo = {};
|
||||
|
||||
module.exports = foo;
|
|
@ -0,0 +1,26 @@
|
|||
const path = require("path");
|
||||
|
||||
/** @type {import("../../../../").Configuration} */
|
||||
module.exports = {
|
||||
node: {
|
||||
__dirname: false,
|
||||
__filename: false
|
||||
},
|
||||
experiments: {
|
||||
layers: true
|
||||
},
|
||||
devtool: "source-map",
|
||||
entry: {
|
||||
main: {
|
||||
import: "./index",
|
||||
layer: "something"
|
||||
}
|
||||
},
|
||||
output: {
|
||||
devtoolModuleFilenameTemplate(info) {
|
||||
const rootDir = process.cwd();
|
||||
const rel = path.relative(rootDir, info.absoluteResourcePath);
|
||||
return `webpack:///${rel}`;
|
||||
}
|
||||
}
|
||||
};
|
Loading…
Reference in New Issue