我无法解析我的 scss 全局变量文件。我正在尝试添加一个 scss 颜色文件,我可以在需要的任何地方简单地全局导入。
Webpack 1 配置:
module: {
loaders: [
{
test: /\.scss$/,
loader: 'style' +
'!css' +
'?sourceMap' +
'&modules' +
'&importLoaders=1' +
'&localIdentName=[local]__[hash:base64:4]' +
'!sass' +
'?sourceMap'
}
]
},
sassLoader: {
includePaths: [
path.resolve(__dirname, '../src/<path to stylesheets>/themes')
]
},
萨斯文件
@import "colors";
.add {
background: $button-inactive-state;
}
错误代码(部分个人物品已编辑)
./~/css-loader?sourceMap&modules&importLoaders=1&localIdentName=[local]__[hash:base64:4]!./~/sass-loader/lib/loader.js?sourceMap!./src/<path to file>/toggle-item-button/item-icon.scss
Module build failed:
@import "colors";
^
File to import not found or unreadable: colors
Parent style sheet: stdin
in /Users/<me>/Checkouts/<my project>/src/<path to file>/toggle-item-button/item-icon.scss (line 1, column 1)
Error:
@import "colors";
^
File to import not found or unreadable: colors
Parent style sheet: stdin
in /Users/<me>/Checkouts/<my project>/src/<path to file>/toggle-item-button/item-icon.scss (line 1, column 1)
at options.error (/Users/<me>/Checkouts/<my project>/node_modules/node-sass/lib/index.js:286:26)
@ ./src/<path to file>/toggle-item-button/item-icon.scss 4:14-229