我的图像文件夹有以下内容:
module.exports = {
test: /\.(png|jpe?g|gif|svg)$/,
include: config.paths.images, // this is: path.resolve(__dirname, '../assets/images')
loader: 'file-loader',
options: {
name: '[path][name].[ext]',
publicPath: '../',
}
};
这就是我的 CSS 的输出:background-image: url(../images/assets/images/doctor-results/g-map-location.png);
我需要的是路径:background-image: url(../images/doctor-results/g-map-location.png);
基本上从路径中删除前 2 个目录,同时保持相对。