Skip to content

[Bug]: Should apply module.generator.outputPath #8539

@GiveMe-A-Name

Description

@GiveMe-A-Name

System Info

System:
OS: macOS 13.6.5
CPU: (10) arm64 Apple M1 Pro
Memory: 832.67 MB / 32.00 GB
Shell: 5.9 - /bin/zsh
Binaries:
npm: 9.8.1 - ~/Library/Application Support/fnm/node-versions/v18.18.2/installation/bin/npm
pnpm: 9.14.1 - ~/Library/Application Support/fnm/node-versions/v18.18.2/installation/bin/pnpm
bun: 1.0.21 - ~/.bun/bin/bun
Browsers:
Chrome: 131.0.6778.86
Safari: 16.6

Details

The config like bellow code:

/** @type {import("../../../../").Configuration} */
module.exports = {
	mode: "development",
	output: {
		assetModuleFilename: "file[ext]"
	},
	module: {
		rules: [
			{
				test: /\.png$/,
				type: "asset/resource",
				generator: {
					publicPath: "https://cdn/assets/",
					outputPath: "cdn-assets/"
				}
			}
		]
	},
	target: 'node',
	entry: '.'
};

But Rspack is not apply module.generator.outputPath when asset generate.

The image was generated to dist/file.png

Reproduce link

https://github.com/web-infra-dev/rspack/tree/main/tests/webpack-test/configCases/asset-modules/rule-generator-outputPath

Reproduce Steps

  1. pnpm install
  2. ./x build
  3. cd tests/webpack-test/configCases/asset-modules/rule-generator-outputPath
  4. npx rspack

Expected: file.png was generated to dist/cdn-assets/file.png
Received: file.png was generated to dist/file.png

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions