我正在尝试使用 blueprintjs,所以我按照教程使用了这一行:
main.sass
@import "~@blueprintjs/core";
但是我的 webpack-dev-server 给了我这个错误日志:
ERROR in ./node_modules/css-loader?{"minimize":false}!./node_modules/postcss-loader/lib?{"sourceMap":true}!./node_modules/resolve-url-loader!./node_modules/sass-loader/lib/loader.js?{"sourceMap":true}!./app/javascript/packs/main.sass
Module build failed:
*/
^
Invalid CSS after " */": expected 1 selector or at-rule, was '"use strict";'
in <redacted>/node_modules/@blueprintjs/core/dist/index.js (line 6, column 4)
webpack: Failed to compile.
所以我很困惑为什么它试图将 index.js 文件作为 sass 解析为 css!
看着./config/webpack/loaders/sass.js
,我没有碰过:
const ExtractTextPlugin = require('extract-text-webpack-plugin')
const { env } = require('../configuration.js')
module.exports = {
test: /\.(scss|sass|css)$/i,
use: ExtractTextPlugin.extract({
fallback: 'style-loader',
use: [
{ loader: 'css-loader', options: { minimize: env.NODE_ENV === 'production' } },
{ loader: 'postcss-loader', options: { sourceMap: true } },
'resolve-url-loader',
{ loader: 'sass-loader', options: { sourceMap: true } }
]
})
}
我只看到它试图读取 sass、scss 和 css 文件。有什么想法我缺少或应该检查吗?