Skip to content

Commit

Permalink
Support Angular 15.0.4
Browse files Browse the repository at this point in the history
  • Loading branch information
valentinpalkovic committed Dec 15, 2022
1 parent 67a0309 commit 57d967d
Showing 1 changed file with 19 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,23 +25,28 @@ export default class StorybookNormalizeAngularEntryPlugin {
}

apply(compiler) {
const webpackOptions = compiler.options;
const entry =
typeof webpackOptions.entry === 'function' ? webpackOptions.entry() : webpackOptions.entry;
compiler.hooks.environment.tap(PLUGIN_NAME, () => {
const webpackOptions = compiler.options;
const entry =
typeof webpackOptions.entry === 'function' ? webpackOptions.entry() : webpackOptions.entry;

webpackOptions.entry = async () => {
const entryResult = await entry;
webpackOptions.entry = async () => {
const entryResult = await entry;

if (entryResult.main && entryResult.styles) {
return {
main: {
import: Array.from(new Set([...entryResult.main.import, ...entryResult.styles.import])),
},
};
}
if (entryResult.main && entryResult.styles) {
return {
main: {
import: Array.from(
new Set([...entryResult.main.import, ...entryResult.styles.import])
),
},
};
}

return entry;
};
});

return entry;
};
compiler.hooks.thisCompilation.tap(PLUGIN_NAME, (compilation) => {
this.compilation = compilation;
});
Expand Down

0 comments on commit 57d967d

Please sign in to comment.