qmzreact 1.0.9 → 1.0.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/conf/config/loaders.js +18 -1
- package/package.json +1 -1
package/conf/config/loaders.js
CHANGED
|
@@ -116,8 +116,25 @@ module.exports = [
|
|
|
116
116
|
loader: 'css-loader',
|
|
117
117
|
options: merge({
|
|
118
118
|
modules: {
|
|
119
|
+
// 1. 开启“局部模式”(意味着:我要对类名进行处理)
|
|
120
|
+
mode: 'local',
|
|
121
|
+
|
|
122
|
+
// 2. 定义生成的规则(名字长什么样)
|
|
119
123
|
localIdentName: '[name]__[local]___[hash:base64:5]',
|
|
120
|
-
exportLocalsConvention: 'camelCase'
|
|
124
|
+
exportLocalsConvention: 'camelCase',
|
|
125
|
+
|
|
126
|
+
// 3. 自定义函数:遇到 node_modules 就“放行”,否则“使用上面的规则”
|
|
127
|
+
getLocalIdent: (context, localIdentName, localName, options) => {
|
|
128
|
+
// 如果是 node_modules 里的文件
|
|
129
|
+
if (context.resourcePath.includes('node_modules')) {
|
|
130
|
+
// 直接返回原始类名(相当于变相的 global 模式)
|
|
131
|
+
return localName;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
// 如果是自己 src 里的文件
|
|
135
|
+
// 返回 null,告诉 css-loader:“请用 localIdentName 的规则去生成哈希”
|
|
136
|
+
return null;
|
|
137
|
+
}
|
|
121
138
|
}
|
|
122
139
|
}, processConfig.cssLoaderOptions)
|
|
123
140
|
},
|