-
-
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
Addon-docs: Resolve mdx-react-shim
& @storybook/global
correctly
#23941
Merged
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
06c554e
add a require.resolve
ndelangen 50bbc54
Merge branch 'next' into norbert/fix-23217
ndelangen ad7b476
add require.resolve around other places as well.
ndelangen b753038
Merge branch 'norbert/fix-23217' of github.com:storybookjs/storybook …
ndelangen 3026181
pack into a packs directory and publish from there
ndelangen ccad64a
Merge branch 'next' into norbert/fix-23217
ndelangen bd55608
Merge branch 'norbert/fix-no-linking-publish' into norbert/fix-23217
ndelangen 8f1ed07
allow mjs files & externalize @storybook/global
ndelangen 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -50,3 +50,5 @@ code/playwright-results/ | |
code/playwright-report/ | ||
code/playwright/.cache/ | ||
code/bench-results/ | ||
|
||
/packs |
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 |
---|---|---|
@@ -1,8 +1,13 @@ | ||
/* eslint-disable import/export */ | ||
import { dirname, join } from 'path'; | ||
|
||
// eslint-disable-next-line import/export | ||
export * from '@storybook/addon-docs/dist/preset'; | ||
|
||
export const mdxLoaderOptions = async (config: any) => { | ||
// eslint-disable-next-line no-param-reassign | ||
config.mdxCompileOptions.providerImportSource = '@storybook/addon-essentials/docs/mdx-react-shim'; | ||
config.mdxCompileOptions.providerImportSource = join( | ||
dirname(require.resolve('@storybook/addon-docs/package.json')), | ||
'/dist/shims/mdx-react-shim' | ||
); | ||
return config; | ||
}; |
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
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.
Why do we need to use
/dist/shims
here, when the exports ofaddon-docs
includesmdx-react-shim
? I thought the way we normally handle bundlers that don't supportexports
(webpack and vite both do, though) was by putting a file at the root which re-exported fromdist
. That feels like a cleaner solution to me, rather than sprinklingdist
throughout our source.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.
@IanVS right, I'd definitely not want users to import directly from
dist
, because what's indist
is internal for us.But that's also the reaosn why I think here it's OK to use:
This is all contained in the monorepo, so I'm less afraid this will break.
Sure I could direct to a root file, and then the root file directs to dist.. but I'd rather have less hoops and less files that need to be there for obscure reasons.
If this works, and therefore 1 less reason for having an root files that's 👍 for me.
I'm hoping that long term we won't have any root files anymore.. but that's likely going to be around the same time when: