webpack.js.org
webpack.js.org copied to clipboard
devtoolModuleFilenameTemplate `info.loaders` is undefined
Bug report
What is the current behavior?
The example given on the docs https://webpack.js.org/configuration/output/#outputdevtoolmodulefilenametemplate suggest using webpack:///${info.resourcePath}?${info.loaders}. But logging info shows that lots of the mentionned keys are not available
If the current behavior is a bug, please provide the steps to reproduce.
Have a webpack config with the following output:
devtoolNamespace: appName,
devtoolModuleFilenameTemplate(info) {
const rootDir = process.cwd()
const rel = path.relative(rootDir, info.absoluteResourcePath)
console.info(info);
return `webpack:///${appName}/${rel}?${info.loaders}`
},
appName is a string. notifications is the current example I'm working on.
The console and sourcemap diffs logs:
{
identifier: [Getter/Setter],
shortIdentifier: [Getter/Setter],
resource: [Getter/Setter],
resourcePath: [Getter/Setter],
absoluteResourcePath: [Getter/Setter],
allLoaders: [Getter/Setter],
query: [Getter/Setter],
moduleId: [Getter/Setter],
hash: [Getter/Setter],
namespace: [Getter/Setter]
}
+?undefined
... etc
What is the expected behavior?
info.loaders should be defined
Other relevant information: webpack version: 5.31.2 webpack-cli version: 4.6.0 Node.js version: 14.16.0 Operating System: Linux workstation 5.10.26-1-lts webpack/webpack#1 SMP x86_64 GNU/Linux (Arch) Additional tools: -
For maintainers only:
- [ ] webpack-4
- [ ] webpack-5
- [ ] bug
- [ ] critical-bug
- [ ] enhancement
- [ ] documentation
- [ ] performance
- [ ] dependencies
- [ ] question
We need update out docs