Skip to content

Commit

Permalink
Merge pull request #23404 from storybookjs/valentin/use-angular-prod-…
Browse files Browse the repository at this point in the history
…mode

Angular: Enable prod mode when Storybook is built
(cherry picked from commit a46cbb1)
  • Loading branch information
valentinpalkovic authored and storybook-bot committed Jul 11, 2023
1 parent 78bb44f commit 83c0c7e
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
3 changes: 3 additions & 0 deletions code/frameworks/angular/src/client/preview-prod.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import { enableProdMode } from '@angular/core';

enableProdMode();
16 changes: 12 additions & 4 deletions code/frameworks/angular/src/preset.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,18 @@ export const addons: PresetProperty<'addons', StorybookConfig> = [
require.resolve('./server/framework-preset-angular-docs'),
];

export const previewAnnotations: StorybookConfig['previewAnnotations'] = (entries = []) => [
...entries,
require.resolve('./client/config'),
];
export const previewAnnotations: StorybookConfig['previewAnnotations'] = (
entries = [],
options
) => {
const annotations = [...entries, require.resolve('./client/config')];

if (options.configType === 'PRODUCTION') {
annotations.unshift(require.resolve('./client/preview-prod'));
}

return annotations;
};

export const core: PresetProperty<'core', StorybookConfig> = async (config, options) => {
const framework = await options.presets.apply<StorybookConfig['framework']>('framework');
Expand Down

0 comments on commit 83c0c7e

Please sign in to comment.