-
Notifications
You must be signed in to change notification settings - Fork 27.5k
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
How to configure a webpack alias #877
Comments
This is bit tricky and you need more support from us because or SSR. |
I'm looking for the same answer. I've checked out your suggestion @arunoda, but it didn't seem to resolve the problem. |
Now we do this like this:
|
@arunoda my use case is a bit closer to @thisbejim than the example used there. Rather than override certain things in production or development, i just want to be able refer to my components with
rather than some combination of
is the suggested way to do that still to create a EDIT: It doesn't seem to work i still get
|
The best option is to go with babel-plugin-module-alias |
Has anyone gotten this to work? I cannot get this aliasing stuff to work so I can eliminate the horrible paths in the imports, ie I have tried babel-plugin-module-alias, babel-plugin-webpack-alias, setting webpack resolve.modules all to no avail. |
I've been using module-alias successfully, just make sure you add the changes from their documentation to your .babelrc file. |
Found my issue, everything is working great now. Thanks! |
There's an example for doing this now https://github.com/zeit/next.js/tree/master/examples/with-absolute-imports |
I'm sorry, I should have made this example when I got mine working. |
@zentuit no worries 😄 👍 |
I'd like to configure some webpack aliases to point to some of my folders (not to a lib in node_modules).
Here is a simple example:
However, if I try to import a component in a page e.g:
I get the following error:
Error: Cannot find module 'components'
Any idea how to get next to play nice with an alias like this?
The text was updated successfully, but these errors were encountered: