Files
Janka UrygaandGitHub 7a6b20c1dd fix(font): don't break directives with inserted next/font import (#72350)
the `next_font_loaders` transform replaces imports from `next/font` with
slightly different ones. unfortunately it was inserting these imports
**at the top** of the file, which broke the `server_actions` transform
because it expects "use server"/"use cache" directives to be the first
item in the file.

this PR changes the logic in the font transform to insert the import in
the place where the original `next/font` import occurred instead of at
the top of the file.

(i suppose that we could just reorder the transforms and run
`server_actions` before `next_font_loaders`, but this feels more robust)

Fixes #72179
2024-11-06 21:16:36 +00:00

6 lines
333 B
JavaScript

import React from 'react';
import firaCode from '@next/font/google/target.css?{"path":"pages/test.tsx","import":"Abel","arguments":[],"variableName":"firaCode"}';
import inter from '@next/font/google/target.css?{"path":"pages/test.tsx","import":"Inter","arguments":[],"variableName":"inter"}';
export { firaCode };
export { inter };