采用@teamsupercell/typings-for-css-modules-loader成功解決問題,,同時還需再css-loader中進行相應(yīng)的配置
const typingsForCssModulesLoaderConf = {
loader: '@teamsupercell/typings-for-css-modules-loader',
options: {
formatter: "prettier"
}
};
開發(fā)環(huán)境配置:
{
test: /\.scss$/,
include: path.resolve(__dirname, './../src'),
use: ['style-loader', typingsForCssModulesLoaderConf, {
loader: 'css-loader',
options: {
modules: {
localIdentName: '[local]_[hash:base64:5]',
},
sourceMap: true,
importLoaders: 2,
localsConvention: 'camelCase'
}
}, 'sass-loader', 'postcss-loader']
},