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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support import aliases #47

Open
Vanuan opened this issue Dec 24, 2024 · 0 comments
Open

Support import aliases #47

Vanuan opened this issue Dec 24, 2024 · 0 comments

Comments

@Vanuan
Copy link

Vanuan commented Dec 24, 2024

Is your feature request related to a problem? Please describe.
Currently, alias resolution doesn't work in MDX. As I understand, MDX files are processed by mdx2-csf which uses Babel internally, while Storybook's builders (like Vite or Webpack) rely on their respective compilers. This difference may cause Vite's configured path aliases to be ignored during the MDX transformation process. When importing components or modules using aliases (e.g., @components/Button), the compiler fails to resolve these paths correctly, leading to broken imports in Storybook.

Describe the solution you'd like
It would be helpful to clarify whether alias resolution should happen at the mdx2-csf level during the MDX transformation process or if it would be more appropriate for Storybook's builder (Vite/Webpack) to handle it during the build phase. This could involve leveraging Vite's internal resolver or providing an option to pass Vite's configuration directly to mdx2-csf.

Describe alternatives you've considered

  • Using absolute paths instead of aliases, which reduces code clarity and increases maintenance overhead.

Additional context
This issue impacts workflows where Vite's alias feature is heavily used for cleaner and more maintainable imports. Ensuring compatibility would streamline integration and reduce the need for workarounds. This feature is especially relevant in monorepos or projects with complex directory structures.

Thank you for considering this enhancement!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant