Skip to content

Commit 94773b4

Browse files
committed
Determine if thread-loader is enabled by checking if emitFile is available
1 parent 14c0824 commit 94773b4

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

index.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,15 +69,16 @@ module.exports = function(source, map) {
6969

7070
if (options.emitCss && css.code) {
7171
const resource = posixify(compileOptions.filename);
72-
const cssPath = options.inlineCss
72+
const threadLoaderUsed = this.emitFile === undefined;
73+
const cssPath = threadLoaderUsed
7374
? `${resource}.css`
7475
: `${resource}.${index++}.css`;
75-
const cssQuery = options.inlineCss
76+
const cssQuery = threadLoaderUsed
7677
? `cssData=${Buffer.from(css.code).toString('base64')}`
7778
: `cssPath=${cssPath}`;
7879
css.code += '\n/*# sourceMappingURL=' + css.map.toUrl() + '*/';
7980
js.code += `\nimport '${cssPath}!=!svelte-loader?${cssQuery}!${resource}'\n;`;
80-
if (!options.inlineCss)
81+
if (!threadLoaderUsed)
8182
virtualModules.set(cssPath, css.code);
8283
}
8384

0 commit comments

Comments
 (0)