我正在尝试加载图像:
background: transparent url("../img/select-icon.png") no-repeat center right 8px;
在我的 style.scss 中,它不起作用
这是我的 webpack.config:
function _path(p) {
return path.join(__dirname, p);
}
module.exports = {
context: __dirname,
entry: [
'./assets/js/index'
],
output: {
path: path.resolve('./assets/bundles/'),
filename: '[name].js'
},
devtool: 'inline-eval-cheap-source-map',
plugins: [
new BundleTracker({filename: './webpack-stats.json'}),
new webpack.ProvidePlugin({
$: 'jquery',
jQuery: 'jquery',
'window.jQuery': 'jquery'
}),
new HappyPack({
id: 'jsx',
threads: 4,
loaders: ["babel-loader"]
})
],
module: {
loaders: [
{
test: /\.css$/,
include: path.resolve(__dirname, './assets/css/'),
loader: "style-loader!css-loader"
},
{
test: /\.scss$/,
include: path.resolve(__dirname, './assets/css/'),
loader: "style-loader!css-loader!sass-loader"
},
{
test: /\.jsx?$/,
include: path.resolve(__dirname, './assets/js/'),
exclude: /node_modules/,
loaders: ["happypack/loader?id=jsx"]
},
{
test: /\.png$/,
loader: 'file-loader'
}
]
},
resolve: {
modulesDirectories: ['node_modules'],
extensions: ['', '.js', '.jsx'],
alias: {
'inputmask' : _path('node_modules/jquery-mask-plugin/dist/jquery.mask'),
},
}
}
我正在使用文件加载器,但在浏览器中呈现的 url 与图像的 url 不匹配。
我认为我没有使用源地图:https ://github.com/webpack/style-loader/issues/55
任何人都可以帮忙吗?