Skip to content

Commit

Permalink
fix(compilation): improve error handling
Browse files Browse the repository at this point in the history
  • Loading branch information
adamdbradley committed Dec 22, 2017
1 parent c119dab commit fd68691
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,29 @@ class StencilPlugin {
this.fs = compiler.inputFileSystem;
this.inspectModules(compilation.assets, compilation.modules).then(() => {
callback();

}).catch(err => {
console.log('Webpack StencilPlugin Error:', err);
callback();
});
});
}

inspectModules(assets: Assets, modules: ComplicationModule[]) {
inspectModules(assets: Assets, modules: ComplicationModule[]): Promise<any> {
if (!assets || !Array.isArray(modules)) {
return Promise.resolve();
}

return Promise.all(modules.map(m => {
return this.addAppAssets(assets, m.resource);
}));
}

async addAppAssets(assets: Assets, filePath: string) {
if (typeof filePath !== 'string') {
return Promise.resolve();
}

const appNamespace = path.basename(filePath, '.js');
const appAssetsDir = path.join(path.dirname(filePath), appNamespace);

Expand Down

0 comments on commit fd68691

Please sign in to comment.