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

Move import of framework module after configs #289

Merged
merged 1 commit into from
Mar 28, 2022
Merged

Move import of framework module after configs #289

merged 1 commit into from
Mar 28, 2022

Conversation

IanVS
Copy link
Member

@IanVS IanVS commented Mar 25, 2022

This should fix storybookjs/storybook#17773. You can check it in the vue example of this repo. In main, the docs tab does not work, and neither does the introduction story. But with this PR, it does. This also aligns us more closely with the webpack builder, which imports the configure function in the virtual story entry, not the config entry. I tested this change in our examples back to storybook 6.4.0.

@IanVS IanVS merged commit 0f14b29 into main Mar 28, 2022
@IanVS IanVS deleted the move-configure branch March 28, 2022 14:26
IanVS added a commit that referenced this pull request Apr 3, 2022
This reverts commit 0f14b29.

# Conflicts:
#	packages/builder-vite/codegen-iframe-script.ts
IanVS added a commit that referenced this pull request Apr 8, 2022
This reverts commit 0f14b29.

# Conflicts:
#	packages/builder-vite/codegen-iframe-script.ts
IanVS added a commit that referenced this pull request Apr 8, 2022
This reverts commit 0f14b29.

# Conflicts:
#	packages/builder-vite/codegen-iframe-script.ts
IanVS added a commit that referenced this pull request 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.
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.

sb + vite + vue: No docs.container on docs tab on clean setup
2 participants