-
Notifications
You must be signed in to change notification settings - Fork 106
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
[Bug] Script entries in preview-head.html
not picked up by Vite during build (working during serve)
#486
Labels
Comments
Thanks for the report, @justrhysism. To help us troubleshoot, could you create a minimal reproduction that we can experiment with? |
@IanVS hello! I faced this issue too. Here is the reproduction repo Reproduction steps:
|
+1 Vite: 4.5.0 (4.4.9 too) |
jcfranco
added a commit
to Esri/calcite-design-system
that referenced
this issue
Nov 20, 2024
**Related Issue:** N/A ## Summary #10482 caused a break in our GitHub deployment. This fix addresses it by: * Adding a `.nojekyll` file to the pages folder to prevent files with leading underscores in their names from being excluded (see https://github.blog/news-insights/bypassing-jekyll-on-github-pages/). * Moving the internal-testing notice to the preview head to leverage the lazy-loaded components in the preview. * We can revisit restoring this in the manager head after storybookjs/builder-vite#486 is resolved.
benelan
pushed a commit
to Esri/calcite-design-system
that referenced
this issue
Feb 8, 2025
**Related Issue:** N/A ## Summary #10482 caused a break in our GitHub deployment. This fix addresses it by: * Adding a `.nojekyll` file to the pages folder to prevent files with leading underscores in their names from being excluded (see https://github.blog/news-insights/bypassing-jekyll-on-github-pages/). * Moving the internal-testing notice to the preview head to leverage the lazy-loaded components in the preview. * We can revisit restoring this in the manager head after storybookjs/builder-vite#486 is resolved.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
What version of
vite
are you using?3.0.9
System info and storybook versions
System:
OS: macOS 12.5.1
CPU: (10) arm64 Apple M1 Max
Binaries:
Node: 16.15.1 - ~/.cache/fnm_multishells/50079_1661262794674/bin/node
Yarn: 1.22.19 - /opt/homebrew/bin/yarn
npm: 8.11.0 - ~/.cache/fnm_multishells/50079_1661262794674/bin/npm
Browsers:
Chrome: 104.0.5112.101
Firefox: 103.0.2
Safari: 15.6.1
npmPackages:
@storybook/addon-a11y: ^6.5.10 => 6.5.10
@storybook/addon-actions: ^6.5.10 => 6.5.10
@storybook/addon-docs: ^6.5.10 => 6.5.10
@storybook/addon-essentials: ^6.5.10 => 6.5.10
@storybook/addon-interactions: ^6.5.10 => 6.5.10
@storybook/addon-jest: ^6.5.10 => 6.5.10
@storybook/addon-links: ^6.5.10 => 6.5.10
@storybook/addons: ^6.5.10 => 6.5.10
@storybook/builder-vite: ^0.2.2 => 0.2.2
@storybook/core-common: ^6.5.10 => 6.5.10
@storybook/jest: ^0.0.10 => 0.0.10
@storybook/testing-library: ^0.0.13 => 0.0.13
@storybook/theming: ^6.5.10 => 6.5.10
Describe the Bug
We have a custom entry point(s) for our scripts and styles; to get them working, we simply added the assets to
preview-head.html
like:When running Storybook as a server, Vite picks up these assets and everything works 👍🏼
However, when building, they are not translated in the resulting
iframe.html
. Indeed Vite never picks them up as they aren't compiled at all (i.e. not in the./static-storybook
directory. Output looks like:I don't know enough of the internal Vite workings to know for sure what's going on, but my gut feel is that it's Storybook's Vite builder config adjusting paths meaning Vite never resolves the target file (and therefore doesn't update the path in the output). More than happy to be proven wrong! 😃
Link to Minimal Reproducible Example
No response
Participation
The text was updated successfully, but these errors were encountered: