由于项目没有放到根目录,样式文件里面的背景图片打包后有问题

在webpack3中可以这样设置

升级到webpack4后我尝试这样配置,但是无效

请问该如何配置呢,非常谢谢
不好意思,我知道怎么改了。。。。
我常规做法还是用alias。
background: url('~@/assets/401_images/401.gif');
怎么改### 能贴一下代码吗?谢谢
@LuoChengIo https://github.com/vuejs/vue-loader/issues/481
@Yanhongliang100 我并不是背景图片问题,我是项目没有放到服务器根目录导致的问题,我最终是修改了config里面的index.js

把这里改成项目放在服务器的文件夹名称就好了
const MiniCssExtractPluginLoader = {
loader: MiniCssExtractPlugin.loader,
options: {
// you can specify a publicPath here
// by default it use publicPath in webpackOptions.output
publicPath: '../../'
}
}
// generate loader string to be used with extract text plugin
function generateLoaders(loader, loaderOptions) {
const loaders = []
// Extract CSS when that option is specified
// (which is the case during production build)
if (options.extract) {
loaders.push(MiniCssExtractPluginLoader)
} else {
loaders.push('vue-style-loader')
}
}
Most helpful comment
这样即可:
const MiniCssExtractPluginLoader = {
loader: MiniCssExtractPlugin.loader,
options: {
// you can specify a publicPath here
// by default it use publicPath in webpackOptions.output
publicPath: '../../'
}
}
// generate loader string to be used with extract text plugin
function generateLoaders(loader, loaderOptions) {
const loaders = []
}