-
Notifications
You must be signed in to change notification settings - Fork 10.3k
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
Webpack aliases causes issues on production build #11352
Comments
Hey @ajayns Could you please link to a minimal reproduction repo for this?
|
https://www.dropbox.com/s/8je98v3suoi9tl6/bug.zip?dl=0 |
Gatsby has a plugin for it - https://www.gatsbyjs.org/packages/gatsby-plugin-alias-imports I gave it a try and worked with your setup. |
or import it like |
Oh I was unaware of this plugin, will give it a try. From what I tried I realized it was an issue only occurring for styled-components because webpack doesn't recognize imports there. So in my project removing the alias imports used for just styled-components worked. |
Great! Just let know if you see any issues further! |
Closing this for the moment because it looks like your issue was resolved by @gurpreet-hanjra 🙂 and the broken imports are specific to styled-components Please feel free to reopen if I've missed something. Thanks! |
Thank you guys for the quick resolution |
Description
Steps to reproduce
gatsby-node.js
with Webpack aliases:Import using an alias, for instance,
import { SCREEN } from 'constants';
and use it in the code. In my case specifically I'm using it with styled-components.Run production build with
gatsby develop
Expected result
Imports should work as expected
Actual result
Environment
The text was updated successfully, but these errors were encountered: