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

Cannot use import alias if route path starts with period #69068

Open
jdhenry08 opened this issue Aug 19, 2024 · 2 comments
Open

Cannot use import alias if route path starts with period #69068

jdhenry08 opened this issue Aug 19, 2024 · 2 comments
Labels
bug Issue was opened via the bug report template.

Comments

@jdhenry08
Copy link

Link to the code that reproduces this issue

https://github.com/jdhenry08/next-route-broken-imports

To Reproduce

  1. View src/app/.well-known/route.ts
  2. Change "../../constants" import to "~/constants" or "src/constants"

Current vs. Expected behavior

Importing the constants file from either of those two paths should work, since they're aliased in tsconfig.json, but the red squiggly remains :(

Provide environment information

Node: 20.9.0
  npm: 9.8.1
  Yarn: 1.22.19
  pnpm: 8.10.2
Relevant Packages:
  next: 14.2.5 // Latest available version is detected (14.2.5).
  eslint-config-next: N/A
  react: 18.3.1
  react-dom: 18.3.1
  typescript: N/A
Next.js Config:
  output: N/A

Which area(s) are affected? (Select all that apply)

Not sure

Which stage(s) are affected? (Select all that apply)

Other (Deployed)

Additional context

No response

@jdhenry08 jdhenry08 added the bug Issue was opened via the bug report template. label Aug 19, 2024
@simonri
Copy link
Contributor

simonri commented Aug 24, 2024

This is due to tsconfig ignoring hidden files (anything that starts with a dot).

You can get around this by adding the folder to the include path in tsconfig.json:

"include": [
  "src/app/.well-known/**/*"
]

@jdhenry08
Copy link
Author

Ah, yup - that did the trick!

Might I suggest that the documentation for setting up the Vercel toolbar/feature flags be updated to mention something along these lines, given that it uses a similar route? Not sure what the right repo is to make that suggestion.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issue was opened via the bug report template.
Projects
None yet
Development

No branches or pull requests

2 participants