Nextjs pages router: You may need an appropriate loader to handle this file type

next: 14.2.15 drizzle: 0.35.3 libsql/client: 0.14.0 To get PDF rendering working, it was suggested to me that I move a route from app router to pages router. Everything checks out on the type level, but I'm getting this error in runtime:
⨯ ../../packages/schema/src/builder/schema.ts
│ Module parse failed: Unexpected token (20:59)
│ You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
│ | createdBy: text("created_by"),
│ | organizationId: text("organization_id"),
│ > status: text("status").notNull().$type<TemplateStatus>(),
│ | title: text("title").notNull(),
│ | scoringMethod: text("scoring_method").notNull().$type<ScoringMethod>(),

│ Import trace for requested module:
│ ../../packages/schema/src/builder/schema.ts
│ ../../packages/schema/src/system/index.ts
│ ./src/pages/api/reports/[organization]/[workspace]/[assessment]/[reportType].tsx
⨯ ../../packages/schema/src/builder/schema.ts
│ Module parse failed: Unexpected token (20:59)
│ You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
│ | createdBy: text("created_by"),
│ | organizationId: text("organization_id"),
│ > status: text("status").notNull().$type<TemplateStatus>(),
│ | title: text("title").notNull(),
│ | scoringMethod: text("scoring_method").notNull().$type<ScoringMethod>(),

│ Import trace for requested module:
│ ../../packages/schema/src/builder/schema.ts
│ ../../packages/schema/src/system/index.ts
│ ./src/pages/api/reports/[organization]/[workspace]/[assessment]/[reportType].tsx
I saw this issue: https://github.com/drizzle-team/drizzle-orm/issues/3155 Switched all my Turso stuff over to using /web but it still happens. Just tried making a minimal repro but it seems to work fine. I'm not familiar with pages router at all, as I started using React/Next with app router. All I know is that this is a webpack thing, I just have no idea why it would error on a column with a type set on it..
GitHub
[BUG]: Drizzle orm + libsql (turso) does not build with NextJS · Is...
What version of drizzle-orm are you using? 0.35.2 What version of drizzle-kit are you using? 0.26.2 Describe the Bug I'm trying to upgrade to latest drizzle openstatusHQ/openstatus#1048 But Bui...
Solution:
for anyone else running into this: needed to add transpilePackages: ["@repo/schema"] to my next config.
Jump to solution
1 Reply
Solution
Kairu
Kairu2mo ago
for anyone else running into this: needed to add transpilePackages: ["@repo/schema"] to my next config.
Want results from more Discord servers?
Add your server