Skip to content

Commit

Permalink
[8.14] Fix storybook config (elastic#182283) (elastic#182293)
Browse files Browse the repository at this point in the history
# Backport

This will backport the following commits from `main` to `8.14`:
- [Fix storybook config
(elastic#182283)](elastic#182283)

<!--- Backport version: 9.4.3 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sqren/backport)

<!--BACKPORT
[{"author":{"name":"Jon","email":"[email protected]"},"sourceCommit":{"committedDate":"2024-05-01T19:35:08Z","message":"Fix
storybook config (elastic#182283)\n\nStorybook is attempting to load an esm
after the merge of elastic#182244. This\r\nupdates the webpack configuration to
only load files from the browser\r\nand main
properties.","sha":"869402b831858240250ceb89bee1929f6cca074c","branchLabelMapping":{"^v8.15.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["Team:Operations","release_note:skip","backport:all-open","ci:build-storybooks","v8.15.0"],"title":"Fix
storybook
config","number":182283,"url":"https://github.com/elastic/kibana/pull/182283","mergeCommit":{"message":"Fix
storybook config (elastic#182283)\n\nStorybook is attempting to load an esm
after the merge of elastic#182244. This\r\nupdates the webpack configuration to
only load files from the browser\r\nand main
properties.","sha":"869402b831858240250ceb89bee1929f6cca074c"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v8.15.0","branchLabelMappingKey":"^v8.15.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/182283","number":182283,"mergeCommit":{"message":"Fix
storybook config (elastic#182283)\n\nStorybook is attempting to load an esm
after the merge of elastic#182244. This\r\nupdates the webpack configuration to
only load files from the browser\r\nand main
properties.","sha":"869402b831858240250ceb89bee1929f6cca074c"}}]}]
BACKPORT-->

Co-authored-by: Jon <[email protected]>
  • Loading branch information
kibanamachine and jbudz authored May 1, 2024
1 parent 4c06b87 commit 583cc60
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions packages/kbn-storybook/src/webpack.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,9 @@ export default ({ config: storybookConfig }: { config: Configuration }) => {
stats,
};

// Override storybookConfig mainFields instead of merging with config
delete storybookConfig.resolve?.mainFields;

const updatedModuleRules = [];
// clone and modify the module.rules config provided by storybook so that the default babel plugins run after the typescript preset
for (const originalRule of storybookConfig.module?.rules ?? []) {
Expand Down

0 comments on commit 583cc60

Please sign in to comment.