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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docs: Fix providerImportSource extension #26868

Merged
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion code/addons/docs/src/plugins/mdx-plugin.ts
Expand Up @@ -32,7 +32,7 @@ export async function mdxPlugin(options: Options): Promise<Plugin> {
mdxCompileOptions: {
providerImportSource: join(
dirname(require.resolve('@storybook/addon-docs/package.json')),
'/dist/shims/mdx-react-shim'
'/dist/shims/mdx-react-shim.mjs'
),
...mdxPluginOptions?.mdxCompileOptions,
rehypePlugins: [
Expand Down
2 changes: 1 addition & 1 deletion code/addons/docs/src/preset.ts
Expand Up @@ -45,7 +45,7 @@ async function webpack(
mdxCompileOptions: {
providerImportSource: join(
dirname(require.resolve('@storybook/addon-docs/package.json')),
'/dist/shims/mdx-react-shim'
'/dist/shims/mdx-react-shim.mjs'
),
...mdxPluginOptions.mdxCompileOptions,
rehypePlugins: [
Expand Down
2 changes: 1 addition & 1 deletion code/addons/essentials/src/docs/preset.ts
Expand Up @@ -5,7 +5,7 @@ export * from '@storybook/addon-docs/dist/preset';
export const mdxLoaderOptions = async (config: any) => {
config.mdxCompileOptions.providerImportSource = join(
dirname(require.resolve('@storybook/addon-docs/package.json')),
'/dist/shims/mdx-react-shim'
'/dist/shims/mdx-react-shim.mjs'
Copy link
Contributor Author

@bashmish bashmish Apr 17, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This exact line is causing a bug for me.
I was wondering why do you even need to override providerImportSource in this @storybook/addon-essentials preset? I mean wouldn't providerImportSource be covered for webpack and vite builder by 2 other files? Maybe instead of fixing it by providing the extension it's better to remove this entire override in this file? I have a setup similar to vite where this is already provided by the builder, so not sure why addon (especially the essentials addon) is overriding this.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ndelangen could you provide the context here? Thanks!

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Uhm... don't have the context why it's needed, though I think @JReinhold probably does.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree that this doesn't look necessary to me. You can try removing it and see if CI still works.

);
return config;
};