CalebBarnes / nextwp

http://nextwp.org/
7 stars 0 forks source link

Latest nextjs version not transpiling by default #81

Open Renesauve opened 3 months ago

Renesauve commented 3 months ago

Error:

Module parse failed: Unexpected token (22:31)
| 
| // react components
> export { FlexibleContent, type Row } from "./src/components/flexible-content";
| export { WordpressTemplate } from "./src/components/wordpress-template";
| export { Icon } from "./src/components/icon";

Import trace for requested module:
./node_modules/.pnpm/@nextwp+core@0.0.2_@babel+core@7.24.4/node_modules/@nextwp/core/index.ts
./src/app/layout.tsx
 ⨯ ./node_modules/.pnpm/@nextwp+core@0.0.2_@babel+core@7.24.4/node_modules/@nextwp/core/index.ts

Temporary workaround by adding this to your next.config

 transpilePackages: ["@nextwp/core"],

Example: https://nextjs.org/blog/next-13-1#built-in-module-transpilation-stable

Add a build step to nextwp so it doesn't need to be transpiled by next