Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Correctly import/prebundle V6 store configs #324

Merged
merged 3 commits into from
Apr 8, 2022
Merged

Conversation

IanVS
Copy link
Member

@IanVS IanVS commented Apr 8, 2022

Closes #305

This reverts #289, and fixes it a better way, by replacing filesystem imports (/@fs/ style absolute path imports) with normal node_modules style imports. So, instead of:

/@fs/Users/ianvs/code/experiments/sb-builder-vite-no-container/node_modules/@storybook/vue3/dist/esm/client/preview/config

We'll import from

@storybook/vue3/dist/esm/client/preview/config

Which vite can correctly pre-bundle and add a browserHash to.

To test this, run the vue example in this repo. You should see some messages about new dependencies being optimized in the terminal, and the storybook should load up just fine with no errors about No docs.container set.

I tested this out back to our minimum supported versions of vite (2.5.2) and storybook (6.4.0). It worked fine, although at that old version, one page refresh was required on the very first startup (due to changes in pre-bundled deps). This doesn't happen in vite 2.9.0, which has better support for finding new deps.

@IanVS IanVS force-pushed the bare-config-imports branch from c4bf6af to c0b6bdb Compare April 8, 2022 15:36
@IanVS IanVS changed the base branch from exclude-prebundles to main April 8, 2022 15:36
Copy link
Member

@shilman shilman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! 💪

Copy link
Member

@joshwooding joshwooding left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@IanVS IanVS changed the title Revert "Move import of framework module after configs (#289)" Correctly import/prebundle V6 store configs Apr 8, 2022
@IanVS IanVS merged commit 6ac11a9 into main Apr 8, 2022
@IanVS IanVS deleted the bare-config-imports branch April 8, 2022 18:02
IanVS added a commit that referenced this pull request Apr 11, 2022
Similar to #324, this avoids the use of `/@fs/` imports in the modern loader, with `storyStoreV7` enabled.

To test, use the react-ts example, install `@storybook/addon-bench`, add it to the `addons` list in `main.js`, and try starting storybook.  It will fail in main, but pass in this branch.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants