in fusion-cli/build/loaders/sw-loader.js [21:58]
function swLoader() {
if (!this.optsContext) {
return '// not supported';
}
this.cacheable(false);
const callback = this.async();
const opts /*: WebpackConfigOpts*/ = this.optsContext;
const compiler = getCompiler(opts);
compiler.run((err, stats) => {
if (err || stats.hasErrors()) {
const info = stats.toJson();
for (let err of info.errors) {
return void callback(new Error(err));
}
}
// Let loader know about compilation dependencies so re-builds are triggered appropriately
for (let fileDep of stats.compilation.fileDependencies) {
this.addDependency(fileDep);
}
for (let contextDep of stats.compilation.contextDependencies) {
this.addContextDependency(contextDep);
}
for (let missingDep of stats.compilation.missingDependencies) {
this.addDependency(missingDep);
this.addContextDependency(missingDep);
}
const bundle = compiler.outputFileSystem.readFileSync(
'/' + SW_OUTPUT_FILENAME
);
const source = getSWTemplateFnSource(bundle);
callback(null, source);
});
}