-
Notifications
You must be signed in to change notification settings - Fork 65
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
SyntaxError: Cannot use import statement outside a module #13
Comments
@darnfish can you provide a Codesandbox/Replit/repo that repros the problem? |
have this issue as well |
Hello, me to! |
Bump, also having this issue |
me as well |
getting same issue |
the same issue here |
can't use right now because of bug. see vercel/geist-font#13
Apparently this error only shows up on I built two new Nextjs 14 apps ( Link to repos I tested this with: Pages Router (error) & App Router (all good). Feel free to StackBlitz these since I couldn't get that to work. |
Also couldn't get Geist package to work in Astro |
Same issue. Using "pages" router. When using Next.js: v14.0.1 |
Also getting this error on nextjs v13.5.4 with pages router. |
Also getting this error on Next 13.4.16 w/pages router |
Me too. Looks like they didn't bother testing it with the pages router. |
Also getting this error with pages |
Having this issue with pages router as well. |
Same - pages router, NextJS 13.4.19 (not updating to13.5/14 because of larger bundle sizes) |
This is a fix that worked for me (
|
This fixed it for me as well.
using Bun as package manager for this one. |
Thanks @spidgorny! This worked for me. I had to also add |
@darnfish I don't think this issue should be closed. It's great we found a workaround, but this is still an issue imo until they add this to the installation instructions on the website or the npm page. |
I think so too. It seems like the source of the issue has not been discovered yet. |
I made a new issue (#59) with more information about this issue, check it out. Hopefully it gets resolved. @VapidLinus @hkgnp |
Try adding this line on the top of your fonts file
Explanation: You may have in your tsconfig a rule to exclude node_modules, which means TypeScript will not check or include any files from the node_modules directory. One solution could be to remove "node_modules" from the exclude array, but this might significantly slow down TypeScript, as it will start checking all files in node_modules. A better solution is to add that triple slash directive on the top of the file. This directive will tell TypeScript to include that specific module in the compilation context. This way, TypeScript will include the geist/font module in the compilation context, even though node_modules is excluded in tsconfig.json. If it doesn't work try restarting the ts server:
|
Font Name (Geist Sans/Geist Mono):
Description of the Issue:
Environment (please complete the following information):
Additional Context:
My
package.json
does not includetype: module
The text was updated successfully, but these errors were encountered: