webpack.js.org icon indicating copy to clipboard operation
webpack.js.org copied to clipboard

devtoolModuleFilenameTemplate `info.loaders` is undefined

Open skjnldsv opened this issue 4 years ago • 2 comments

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: -

skjnldsv avatar Apr 16 '21 08:04 skjnldsv

For maintainers only:

  • [ ] webpack-4
  • [ ] webpack-5
  • [ ] bug
  • [ ] critical-bug
  • [ ] enhancement
  • [ ] documentation
  • [ ] performance
  • [ ] dependencies
  • [ ] question

webpack-bot avatar Apr 16 '21 08:04 webpack-bot

We need update out docs

alexander-akait avatar Apr 16 '21 11:04 alexander-akait