Skip to content

Commit 8f63423

Browse files
committed
Only write virtual files if there's a webpack instance initialized. Make cssEmit test pass
1 parent 7e3f749 commit 8f63423

File tree

3 files changed

+317
-287
lines changed

3 files changed

+317
-287
lines changed

index.js

+4-1
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,10 @@ module.exports = function(source, map) {
116116
);
117117
css.code += '\n/*# sourceMappingURL=' + css.map.toUrl() + '*/'
118118
js.code = js.code + `\nrequire('${cssFilepath}');\n`
119-
virtualModules.writeModule(cssFilepath, css.code)
119+
/** If the webpack compiler is initialized, write the file to its vitual file system */
120+
if(this.fs) {
121+
virtualModules.writeModule(cssFilepath, css.code)
122+
}
120123
}
121124

122125
if (options.hotReload && !isProduction && !isServer) {

0 commit comments

Comments
 (0)