您好我在尝试导入sass-loader时遇到此错误。
错误 ./~/css-loader!./~/resolve-url-loader!./~/sass-loader?sourceMap!./src/styles/main.scss 找不到模块:错误:无法解决 '../../static/fonts/OpenSans-Regular.woff2'in 'D:\ KumarYa1 \ Workplace \ React \ git_react \ ReactApp \ src \ styles'@ ./~/css-loader!./~/resolve-url-loader!./~/sass-loader?sourceMap!./src/styles/main.scss 6:1027-1079 @ ./src/styles/main.scss @ ./renderer.js
webpack.config.js
module.exports = {
entry: "./renderer.js",
output: {
filename: "public/bundle.js"
},
module: {
loaders: [
{
test: /\.jsx?$/,
exclude: /(node_modules|bower_components)/,
loader: 'babel-loader',
query: {
presets: ['react', 'es2015']
}
},
{
test: /\.woff(2)?(\?v=[0-9]\.[0-9]\.[0-9])?$/,
loader: 'url-loader?limit=10000&mimetype=application/font-woff'
},
{
test : /\.css$/,
loaders: ['style-loader', 'css-loader', 'resolve-url-loader']
},
{
test : /\.scss$/,
loaders: ['style-loader', 'css-loader', 'resolve-url-loader', 'sass-loader?sourceMap']
}
]
}
}
答案 0 :(得分:0)
你可以尝试在scss loader中添加一个resolve-url吗?
...
{
test: /\.scss$/,
loader: 'style!css!sass!resolve-url!sass?sourceMap'
}
...