Skip to content

Commit f5d5285

Browse files
committed
Determine if thread-loader is enabled by checking if emitFile is available
1 parent 48f1746 commit f5d5285

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
@@ -65,15 +65,16 @@ module.exports = function(source, map) {
6565

6666
if (options.emitCss && css.code) {
6767
const resource = posixify(compileOptions.filename);
68-
const cssPath = options.inlineCss
68+
const threadLoaderUsed = this.emitFile === undefined;
69+
const cssPath = threadLoaderUsed
6970
? `${resource}.css`
7071
: `${resource}.${index++}.css`;
71-
const cssQuery = options.inlineCss
72+
const cssQuery = threadLoaderUsed
7273
? `cssData=${Buffer.from(css.code).toString('base64')}`
7374
: `cssPath=${cssPath}`;
7475
css.code += '\n/*# sourceMappingURL=' + css.map.toUrl() + '*/';
7576
js.code += `\nimport '${cssPath}!=!svelte-loader?${cssQuery}!${resource}'\n;`;
76-
if (!options.inlineCss)
77+
if (!threadLoaderUsed)
7778
virtualModules.set(cssPath, css.code);
7879
}
7980

0 commit comments

Comments
 (0)