next.js
7a6b20c1 - fix(font): don't break directives with inserted next/font import (#72350)

Commit
1 year ago
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
Author
Parents
Loading