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

fix(storybook): fix alias paths with tsconfig plugin #12943

Merged

Conversation

TylerAPfledderer
Copy link
Contributor

@TylerAPfledderer TylerAPfledderer commented May 10, 2024

Description

Adds and configures the tsconfig-paths-webpack-plugin for webpack to consistently resolve path aliases in TypeScript modules.

See Storybook Docs regarding this webpack recommendation.

Also updates import paths in existing story files that use imports from the public folder.

Current Behavior

Errors would throw specifically for the path alias to the public folder (@/public) saying it could not resolve the aliased path. But the alias @ for the src directory would always resolve successfully.

For example, attempt to render a story involving an image being import from @/public/**, either in the component or in the story file.

New Behavior

tsconfig-paths-webpack-plugin utilizes the project's tsconfig to handle resolving of path aliases, without the need to explicitly specify them again.

cc @pettinarip, @corwintines

Copy link

netlify bot commented May 10, 2024

Deploy Preview for ethereumorg ready!

Name Link
🔨 Latest commit 050d81e
🔍 Latest deploy log https://app.netlify.com/sites/ethereumorg/deploys/663d8b3260b1e70007238586
😎 Deploy Preview https://deploy-preview-12943--ethereumorg.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
Lighthouse
Lighthouse
7 paths audited
Performance: 51 (🔴 down 5 from production)
Accessibility: 92 (no change from production)
Best Practices: 94 (🔴 down 4 from production)
SEO: 95 (no change from production)
PWA: -
View the detailed breakdown and full score reports

To edit notification comments on pull requests, go to your Netlify site configuration.

@TylerAPfledderer TylerAPfledderer changed the title fix(.storybook): fix alias paths with tsconfig plugin fix(storybook): fix alias paths with tsconfig plugin May 10, 2024
Copy link
Member

@pettinarip pettinarip left a comment

Choose a reason for hiding this comment

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

Nice, reducing redundancy and fixing issues 👍🏼 Thanks @TylerAPfledderer

@corwintines corwintines merged commit 6a588cd into ethereum:dev May 14, 2024
10 checks passed
@TylerAPfledderer TylerAPfledderer deleted the fix/storybook-path-aliases branch May 14, 2024 02:15
This was referenced May 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dependencies 📦 Changes related to project dependencies
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants