-
Notifications
You must be signed in to change notification settings - Fork 4.6k
Storybook: skip transpilation of build-modules files #73780
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
Conversation
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message. To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
|
Size Change: 0 B Total Size: 2.58 MB ℹ️ View Unchanged
|
|
Flaky tests detected in 128f703. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/19960035179
|
mirka
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Works for me, but I guess this is only until we move away from Webpack?
The same issues are going to be there with Vite or any other bundler:
This particular patch will not fully disappear, it will be migrated. |
Spinoff from #73516 that updates the Storybook build config so that it doesn't transpile files in
build-modulefolders. These are already transpiled bywp-build.The method is somewhat complicated: find the
babel-loaderrule added by@storybook/addon-webpack5-compiler-babeland modify itsexcludefield.I hoped to see a performance improvement, but there isn't any 🙁 My tests show that
npm run storybook:buildtimings are exactly the same before and after this PR. But I still believe it's worth doing.There's one thing that could optimize the Storybook build a lot, but I don't know how to do it. When importing stuff from a package like
@wordpress/components, it can be imported from two different places:*.story.tsxfile imports a component, it imports it from the source. For example, thebutton/stories/index.story.tsxfile has animport Button from '..'statement. That imports thesrc/button/index.tsxfile directly.@wordpress/block-editorwhich in turn importsButtonfrom@wordpress/components, then the@wordpress/componentsfiles are resolved from the transpiledbuild-modulefolder.In the end, the bundle ends up shipping two copies of the
Button.If the
import Button from '..'statement could be somehow resolved to the transpiledbuild-modulefolder, that would save a lot of duplication and double transpilation. But I don't know how to do it.If we figured it out, it would be an optimization valuable even after migrating Storybook build from webpack5 to Vite.