css-loader 5.2.5 → 5.2.6
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/dist/index.js +3 -2
- package/dist/utils.js +8 -5
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -98,8 +98,9 @@ async function loader(content, map, meta) {
|
|
|
98
98
|
|
|
99
99
|
const icssPluginImports = [];
|
|
100
100
|
const icssPluginApi = [];
|
|
101
|
+
const needToUseIcssPlugin = (0, _utils.shouldUseIcssPlugin)(options);
|
|
101
102
|
|
|
102
|
-
if (
|
|
103
|
+
if (needToUseIcssPlugin) {
|
|
103
104
|
const icssResolver = this.getResolve({
|
|
104
105
|
conditionNames: ["style"],
|
|
105
106
|
extensions: [],
|
|
@@ -178,6 +179,6 @@ async function loader(content, map, meta) {
|
|
|
178
179
|
|
|
179
180
|
const importCode = (0, _utils.getImportCode)(imports, options);
|
|
180
181
|
const moduleCode = (0, _utils.getModuleCode)(result, api, replacements, options, this);
|
|
181
|
-
const exportCode = (0, _utils.getExportCode)(exports, replacements, options);
|
|
182
|
+
const exportCode = (0, _utils.getExportCode)(exports, replacements, needToUseIcssPlugin, options);
|
|
182
183
|
callback(null, `${importCode}${moduleCode}${exportCode}`);
|
|
183
184
|
}
|
package/dist/utils.js
CHANGED
|
@@ -675,8 +675,14 @@ function dashesCamelCase(str) {
|
|
|
675
675
|
return str.replace(/-+(\w)/g, (match, firstLetter) => firstLetter.toUpperCase());
|
|
676
676
|
}
|
|
677
677
|
|
|
678
|
-
function getExportCode(exports, replacements, options) {
|
|
678
|
+
function getExportCode(exports, replacements, needToUseIcssPlugin, options) {
|
|
679
679
|
let code = "// Exports\n";
|
|
680
|
+
|
|
681
|
+
if (!needToUseIcssPlugin) {
|
|
682
|
+
code += `${options.esModule ? "export default" : "module.exports ="} ___CSS_LOADER_EXPORT___;\n`;
|
|
683
|
+
return code;
|
|
684
|
+
}
|
|
685
|
+
|
|
680
686
|
let localsCode = "";
|
|
681
687
|
|
|
682
688
|
const addExportToLocalsCode = (name, value) => {
|
|
@@ -768,10 +774,7 @@ function getExportCode(exports, replacements, options) {
|
|
|
768
774
|
return code;
|
|
769
775
|
}
|
|
770
776
|
|
|
771
|
-
|
|
772
|
-
code += options.modules.namedExport ? localsCode : `___CSS_LOADER_EXPORT___.locals = {\n${localsCode}\n};\n`;
|
|
773
|
-
}
|
|
774
|
-
|
|
777
|
+
code += options.modules.namedExport ? localsCode : `___CSS_LOADER_EXPORT___.locals = {${localsCode ? `\n${localsCode}\n` : ""}};\n`;
|
|
775
778
|
code += `${options.esModule ? "export default" : "module.exports ="} ___CSS_LOADER_EXPORT___;\n`;
|
|
776
779
|
return code;
|
|
777
780
|
}
|