-
-
Notifications
You must be signed in to change notification settings - Fork 9.4k
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
Vitest: Add plugins from viteFinal
#30105
Open
JReinhold
wants to merge
21
commits into
next
Choose a base branch
from
jeppe/support-svelte-csf-in-vitest
base: next
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+117
−271
Open
Changes from all commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
4fdafc1
rename packageDir
JReinhold 5110c71
don't enforce pre on the vitest plugin
JReinhold a079a28
selectively optimize modules to not let vite optimize everything (it …
JReinhold 8bc928b
add plugins from viteFinal
JReinhold 89036fe
don't exclude stories.svelte files from svelte sandboxes
JReinhold 2259584
support undefined plugins array
JReinhold 4bce136
remove vite plugins unnecessary for testing
JReinhold 20f5254
also ignore @joshwooding/vite-plugin-react-docgen-typescript
JReinhold c38eed3
don't add plugins during postinstall
JReinhold 470c04c
don't tell users to add framework plugins in docs
JReinhold 21873f1
add migration note about removing duplicate vite configurations
JReinhold 4512a5a
remove docs on manual Framework plugins
JReinhold a045f4e
don't add framework plugins to sandboxes
JReinhold 5bb9a7f
fix react-vite and nextjs-vite viteFinals discarding configs from pre…
JReinhold e1cd01a
cleanup viteFinals
JReinhold 2e1ad63
Merge branch 'next' into jeppe/support-svelte-csf-in-vitest
JReinhold 5591ef4
Merge branch 'next' into jeppe/support-svelte-csf-in-vitest
JReinhold 7c95fe0
Merge branch 'next' of github.com:storybookjs/storybook into jeppe/su…
JReinhold 3c0886b
merge rnw preset changes
JReinhold a260929
Merge branch 'next' into jeppe/support-svelte-csf-in-vitest
JReinhold f7285f0
Merge branch 'next' of github.com:storybookjs/storybook into jeppe/su…
JReinhold File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,7 +13,7 @@ export const core: PresetProperty<'core'> = { | |
}; | ||
|
||
export const viteFinal: NonNullable<StorybookConfig['viteFinal']> = async (config, { presets }) => { | ||
const { plugins = [] } = config; | ||
const plugins = [...(config?.plugins ?? [])]; | ||
|
||
// Add docgen plugin | ||
const { reactDocgen: reactDocgenOption, reactDocgenTypescriptOptions } = await presets.apply<any>( | ||
|
@@ -51,5 +51,5 @@ export const viteFinal: NonNullable<StorybookConfig['viteFinal']> = async (confi | |
); | ||
} | ||
|
||
return config; | ||
return { ...config, plugins }; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. before, this preset would discard any config set by previous
JReinhold marked this conversation as resolved.
Show resolved
Hide resolved
|
||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
without-vite-plugins
uses atype
import fromvite
. That means that theexperimental-addon-test
also depends on Vite; otherwise, thePluginOption
cannot be resolved in package manager environments, which are strict about peer dependencies.Generally, I like to avoid relative imports like this because of the likelihood is high that the package that imports from another package utils or functions doesn't get the dependencies right. It can easily be overseen.
If I were you, I would copy-paste the helper function and remove the
PluginOptions
reference. Otherwise,experimental-addon-test
needs to mention vite as a peer dependency.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.
But type imports are stripped from the
dist
, so it wouldn't show up in the package, so it's not necessary. Unless the imported type made its way into a generated.d.ts
file, but it doesn't because it's not part of the public API.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.
Right, I am talking about the
.d.ts
file. Maybe you can check, whether avite
import is part of it.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.
But it's fair to be defensive and say maybe in the future that module would import from dependencies that were in the original package but not the sibling package, without considering the sibling package.