Replies: 5 comments 2 replies
-
Not sure about your specific issue. Here's a base template for DuckDB-Wasm shell with Next.js. Note the webpack config in https://github.com/pgzmnk/nextjs-typescript/blob/main/next.config.js |
Beta Was this translation helpful? Give feedback.
-
nextjs config now has a transpileModules prop which accepts string[]. Simply add the duckdb packages' names in there. Hope this helps! |
Beta Was this translation helpful? Give feedback.
-
Did you ever get around this? |
Beta Was this translation helpful? Give feedback.
-
Not very helpful, but this is almost solved in the new the unreleased nextjs@15 In
However, this does not work with |
Beta Was this translation helpful? Give feedback.
-
I'd love to know why this problem happens. Why are nextjs and duckdb incompatible in this way? Knowing more might help figure out workarounds. |
Beta Was this translation helpful? Give feedback.
-
Summary
I have just started to use next.js
I am running mainly on windows but I have tried duckdb-async with next.js on both ubuntu and windows
I am using node version 18.16.0
I have tried duckdb-async in fastify and express and it worked
I have added duckdb-async and webpack to my project next.js project
From the web pack documentation (https://nextjs.org/docs/app/api-reference/next-config-js/webpack) its not clear what I need to configure to make it work
I recieve the following error
Module parse failed: Unexpected token (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
Import trace for requested module:
./node_modules/@mapbox/node-pre-gyp/lib/util/nw-pre-gyp/index.html
./node_modules/@mapbox/node-pre-gyp/lib/ sync ^./.*$
./node_modules/@mapbox/node-pre-gyp/lib/node-pre-gyp.js
./node_modules/duckdb/lib/duckdb-binding.js
./node_modules/duckdb/lib/duckdb.js
./node_modules/duckdb-async/dist/duckdb-async.js
./src/app/api/duckdb/route.ts
Additional information
Example
https://drive.google.com/file/d/1dceXEXiaH01-SJKxu2ckgoWCTf8f79Rm/view?usp=sharing
Beta Was this translation helpful? Give feedback.
All reactions