-
Notifications
You must be signed in to change notification settings - Fork 27.6k
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
Automatically configure webpack to handle tsconfig.json
's baseUrl
and paths
#7779
Comments
Hey @liamdanielduffy! Next.js currently doesn't translate For now, please customize your webpack configuration using |
tsconfig.json
's baseUrl
and paths
Awesome :) thanks @Timer! |
Holy moly this will be incredible to seeing this! I mean, I love you guys, the NextJS team. For removing all these unnecessary configs, etc. - that's cool |
Feel free to implement this! I think we should also support |
This comment has been minimized.
This comment has been minimized.
This is now supported in the latest Next.js canary version: You'll need to enable the feature flag as explained in #11293. |
This issue has been automatically locked due to no recent activity. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you. |
Bug report
Describe the bug
Reproduction here: https://github.com/liamdanielduffy/next-9-baseurl-reproduction
I've setup a simple Next.js project using v 9.0.0, with a tsconfig.json generated by Next
I've added the 'baseUrl' compiler option to 'tsconfig.json' in the root of my repository. The baseUrl is
./
since I want paths in my Next app to resolve relative to the root of my repository.I've created a test import in
pages/index.tsx
which imports a string constant.When I run this locally with
now dev
, I get the following error:ModuleNotFoundError: Module not found: Error: Can't resolve 'constants/test'
I've also deployed this to Now under this project:
/liamdanielduffy/app-workflow/6ijvjnt5c
I get the same error during build:
To Reproduce
Steps to reproduce the behavior, please provide code snippets or a repository:
now dev
in the root to see the local build errornow
to deploy and see the build error in the Now environmentExpected behavior
Next should be able to resolve modules imported within
.ts
or.tsx
files relative to the"baseUrl"
set in"compilerOptions"
of tsconfig.jsonThe text was updated successfully, but these errors were encountered: