我有一个问题,在这个问题中,我必须将css中的所有urls从'../images/‘更改为'../../images’。因为我的开发版本的结构与生产版本不同。
我现在正在从gulp迁移,无法解决这个问题。
这是我的Webpack 3开发配置。
const FilterWarningsPlugin = require('webpack-filter-warnings-plugin');
const webpack = require('webpack');
const path = require('path');
module.exports = {
entry: ['webpack-dev-server/client?http://localhost:5100', 'babel-polyfill', './src/index.js'],
output: {
path: path.join(__dirname, '/public/js'),
publicPath: '/barfe/ui/',
filename: 'main.js'
},
context: path.resolve(__dirname),
devtool: 'source-map',
devServer: {
hot: false,
inline: false,
host: 'localhost',
port: '5100',
index: 'index.html',
historyApiFallback: true,
headers: { 'Access-Control-Allow-Origin': '*' },
setup(app) {
app.get('/', (req, res) => {
res.redirect(301, 'http://localhost:5100/barfe/ui/#/');
});
},
proxy: {
'/barfe/api': {
target: 'https://555.555.55.555',
secure: false
}
}
},
module: {
rules: [
{
test: /\.(jpe?g|png|gif|woff|woff2|eot|ttf|svg)$/i,
use: ['resolve-url-loader', 'url-loader?limit=10000', 'img-loader']
},
{
test: /\.(scss|css)$/,
use: [
'style-loader',
'css-loader',
'resolve-url-loader',
{
loader: 'sass-loader'
}
]
},
]
}
};
发布于 2018-06-09 03:47:52
我是通过使用
use: ExtractTextPlugin.extract({
fallback: 'style-loader',
use: [
'css-loader',
'resolve-url-loader',
{
loader: 'sass-loader',
options: {
sourceMap: true
}
}
]
})
https://stackoverflow.com/questions/50761194
复制相似问题