Skip to content

Commit 99095aa

Browse files
chore: update other packages
1 parent d182d67 commit 99095aa

File tree

2 files changed

+33
-33
lines changed

2 files changed

+33
-33
lines changed

src/index.js

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,35 @@ export default async function loader(content, map, meta) {
5656
plugins.push(...getModulesPlugins(options, this));
5757
}
5858

59+
const icssPluginImports = [];
60+
const icssPluginApi = [];
61+
62+
if (shouldUseIcssPlugin(options)) {
63+
const icssResolver = this.getResolve({
64+
conditionNames: ['style'],
65+
extensions: [],
66+
mainFields: ['css', 'style', 'main', '...'],
67+
mainFiles: ['index', '...'],
68+
});
69+
70+
plugins.push(
71+
icssParser({
72+
imports: icssPluginImports,
73+
api: icssPluginApi,
74+
replacements,
75+
exports,
76+
context: this.context,
77+
rootContext: this.rootContext,
78+
resolver: icssResolver,
79+
urlHandler: (url) =>
80+
stringifyRequest(
81+
this,
82+
getPreRequester(this)(options.importLoaders) + url
83+
),
84+
})
85+
);
86+
}
87+
5988
const importPluginImports = [];
6089
const importPluginApi = [];
6190

@@ -108,35 +137,6 @@ export default async function loader(content, map, meta) {
108137
);
109138
}
110139

111-
const icssPluginImports = [];
112-
const icssPluginApi = [];
113-
114-
if (shouldUseIcssPlugin(options)) {
115-
const icssResolver = this.getResolve({
116-
conditionNames: ['style'],
117-
extensions: [],
118-
mainFields: ['css', 'style', 'main', '...'],
119-
mainFiles: ['index', '...'],
120-
});
121-
122-
plugins.push(
123-
icssParser({
124-
imports: icssPluginImports,
125-
api: icssPluginApi,
126-
replacements,
127-
exports,
128-
context: this.context,
129-
rootContext: this.rootContext,
130-
resolver: icssResolver,
131-
urlHandler: (url) =>
132-
stringifyRequest(
133-
this,
134-
getPreRequester(this)(options.importLoaders) + url
135-
),
136-
})
137-
);
138-
}
139-
140140
// Reuse CSS AST (PostCSS AST e.g 'postcss-loader') to avoid reparsing
141141
if (meta) {
142142
const { ast } = meta;

test/__snapshots__/modules-option.test.js.snap

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4080,7 +4080,7 @@ var ___CSS_LOADER_URL_REPLACEMENT_0___ = ___CSS_LOADER_GET_URL_IMPORT___(___CSS_
40804080
// Module
40814081
___CSS_LOADER_EXPORT___.push([module.id, \\"a {\\\\n background: url(\\" + ___CSS_LOADER_URL_REPLACEMENT_0___ + \\");\\\\n}\\\\n\\\\nbody {\\\\n background: \\" + ___CSS_LOADER_ICSS_IMPORT_0____NAMED___[\\"vUrlOther\\"] + \\";\\\\n}\\\\n\\", \\"\\"]);
40824082
// Exports
4083-
export const vUrl = \\"url(\\" + ___CSS_LOADER_URL_REPLACEMENT_0___ + \\")\\";
4083+
export const vUrl = \\"url('./img.png')\\";
40844084
export const vUrlOther = \\"\\" + ___CSS_LOADER_ICSS_IMPORT_0____NAMED___[\\"vUrlOther\\"] + \\"\\";
40854085
export default ___CSS_LOADER_EXPORT___;
40864086
"
@@ -4101,7 +4101,7 @@ Array [
41014101
}
41024102

41034103
body {
4104-
background: url(/webpack/public/path/img.png);
4104+
background: url('./img.png');
41054105
}
41064106
",
41074107
"",
@@ -4126,7 +4126,7 @@ var ___CSS_LOADER_URL_REPLACEMENT_0___ = ___CSS_LOADER_GET_URL_IMPORT___(___CSS_
41264126
___CSS_LOADER_EXPORT___.push([module.id, \\"a {\\\\n background: url(\\" + ___CSS_LOADER_URL_REPLACEMENT_0___ + \\");\\\\n}\\\\n\\\\nbody {\\\\n background: \\" + ___CSS_LOADER_ICSS_IMPORT_0___.locals[\\"v-url-other\\"] + \\";\\\\n}\\\\n\\", \\"\\"]);
41274127
// Exports
41284128
___CSS_LOADER_EXPORT___.locals = {
4129-
\\"v-url\\": \\"url(\\" + ___CSS_LOADER_URL_REPLACEMENT_0___ + \\")\\",
4129+
\\"v-url\\": \\"url('./img.png')\\",
41304130
\\"v-url-other\\": \\"\\" + ___CSS_LOADER_ICSS_IMPORT_0___.locals[\\"v-url-other\\"] + \\"\\"
41314131
};
41324132
export default ___CSS_LOADER_EXPORT___;
@@ -4148,7 +4148,7 @@ Array [
41484148
}
41494149

41504150
body {
4151-
background: url(/webpack/public/path/img.png);
4151+
background: url('./img.png');
41524152
}
41534153
",
41544154
"",

0 commit comments

Comments
 (0)