-
Notifications
You must be signed in to change notification settings - Fork 26.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
next/font bug when code is instrumented #44433
Comments
My colleague (@jch2617) pointed out that setting EDIT: did not fix in CI |
@frattaro Were you able to solve this ? |
updated repro to use builtin |
Updated repro package-lock and retested with |
No change with latest package updates |
I'm following this until |
+1 I am experiencing the same with ./src/ui/theme/theme.tsx
Error:
× Font loaders must be called and assigned to a const in the module scope
15 │ import localFont from 'next/font/local';
16 │
17 │ export const interFont = localFont({
· ─────────
18 │ variable: '--font-inter',
19 │ src: [
20 │ {
╰──── |
The issue with Google fonts is present as well when using Stacktrace
|
@frattaro @finn-orsini were you able to solve this? Getting the same error. |
@mathurmehul001 I haven't checked since my last update (2 weeks ago). Since then, the next team introduced some breaking changes in a patch fix that made it so I have to wait until AWS makes changes to their stuff for me to update. |
@MenaiAla I faced this issue because of conflicts between swc-plugin-coverage-instrument and next.js font. Wasn't able to fix this. |
This comment has been minimized.
This comment has been minimized.
This is neither next.js's problem or plugin's, it's a conflict requirement between 2 features. next/font requires to have specific scope to call, but coverage wraps calls into paren scope to inject coverage counter. There's no easy way to detect those 2 conflict detect each other. Disabling coverage to specific offending line allows to skip coverage attempts to change unexpected scopes to the next/font.
|
Closing issue as answered. |
This closed issue has been automatically locked because it had no new activity for 2 weeks. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you. |
Verify canary release
Provide environment information
Which area(s) of Next.js are affected? (leave empty if unsure)
Font optimization (@next/font), SWC transpilation
Link to the code that reproduces this issue
https://github.com/frattaro/next-font-repro
To Reproduce
Clone the repo
Run
npm i
Run
npm run dev
Describe the Bug
When
swc-plugin-coverage-instrument
swc plugin is used this error from@next/font
is triggered:Expected Behavior
SWC is expected to be able to build without issue.
Which browser are you using? (if relevant)
No response
How are you deploying your application? (if relevant)
No response
The text was updated successfully, but these errors were encountered: