-
-
Notifications
You must be signed in to change notification settings - Fork 9.4k
Closed
Description
Bug report
Case 1: publicPath is not "auto"
What is the current behavior?
With following webpack config:
// webpack.config.js
module.exports = {
entry: 'index.css',
output: {
publicPath: 'aaa.com/aa/',
},
module: {
rules: [{ test: /\.png$/, type: 'asset/resource' }],
},
experiments: {
css: true,
},
}/* index.css */
.a {
background-image: url(./bg.png);
}will generate:
.foo {
background-image: url(bg.png); /* <-- wrong */
}
head{--webpack-main:\.\/index\.css;}What is the expected behavior?
It should generate:
.foo {
background-image: url(aaa.com/aa/bg.png);
}
head{--webpack-main:\.\/index\.css;}Case 2: publicPath is "auto"
What is the current behavior?
With following webpack config:
// webpack.config.js
module.exports = {
entry: 'index.css',
output: {
// publicPath: "auto" is default value
cssFilename: 'css/[name].css',
assetModuleFilename: 'assets/[name][ext]',
},
module: {
rules: [{ test: /\.png$/, type: 'asset/resource' }],
},
experiments: {
css: true,
},
}/* index.css */
.a {
background-image: url(./bg.png);
}will generate:
.foo {
background-image: url(assets/bg.png); /* <-- wrong */
}
head{--webpack-main:\.\/index\.css;}What is the expected behavior?
It should generate:
.foo {
background-image: url(../assets/bg.png);
}
head{--webpack-main:\.\/index\.css;}Other relevant information:
webpack version: 5.76.3
Node.js version: 18
Operating System: osx
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels