"You may need an appropriate loader" importing schema from monorepo db package client side
Answered
Yellow-breasted Bunting posted this in #help-forum
Yellow-breasted BuntingOP
Hey all, I'm trying to import a drizzle schema to the client side and I'm getting a webpack loader error:
I saw this similar issue but exporting the function from the db/index.ts gives the same error
https://github.com/drizzle-team/drizzle-orm/discussions/885
Any ideas? Thank you!
../../packages/db/utils/index.ts
Module parse failed: Unexpected token (11:1)
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'use client'
import { formatStatus } from "db/utils"
const Test = () => {
return (
<div>
{formatStatus("accepted-paid")}
</div>
);
}I saw this similar issue but exporting the function from the db/index.ts gives the same error
https://github.com/drizzle-team/drizzle-orm/discussions/885
Any ideas? Thank you!
2 Replies
Yellow-breasted BuntingOP
Do I need to compile my db package into js?
Answer
Yellow-breasted BuntingOP
Ahhh I see, just got to use
const nextConfig = {
transpilePackages: ['db'],
}