Next.js Discord

Discord Forum

serverExternalPackages in build not being used?

Unanswered
Transvaal lion posted this in #help-forum
Open in Discord
Transvaal lionOP
when on dev, i have this on my next.config.ts
const nextConfig: NextConfig = {
serverExternalPackages: ["@duckdb/node-bindings-linux-x64"],
};

And i'm able to make the duckdb driver work. Now when doing npm run build, it throws with this error
./node_modules/@duckdb/node-bindings-linux-x64/duckdb.node
Module parse failed: Unexpected character '' (1:0)
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
(Source code omitted for this binary file)

which is same as if the serverExternalPackages is not present when on npm run dev. Is there a way to force webpack to use the serverExternalPackages?

0 Replies