oracle / node-oracledb

Oracle Database driver for Node.js maintained by Oracle Corp.
http://oracle.github.io/node-oracledb/
Other
2.24k stars 1.07k forks source link

Next.js 14 Thin mode: Critical dependency #1678

Open saphitv opened 3 weeks ago

saphitv commented 3 weeks ago
  1. What versions are you using? database version: 19.0.0 platform: win32 node version: v21.4.0 arch: x64 library version: 6.5.1

  2. Describe the problem When I do a build of a nextjs application with oracledb in Thin mode I get build warnings.

./node_modules/oracledb/lib/oracledb.js
Dependency critical: the require function is used in such a way that dependencies cannot be extracted statically.

Track the import of the require module:
./node_modules/oracledb/lib/oracledb.js
./node_modules/oracledb/index.js
./src/actions/others.ts
./src/components/view/topbar/top-bar.tsx
./src/app/page.tsx

The file that is shown performs this simple import (I don't think import is the problem): import { BIND_OUT, CLOB, STRING} from "oracledb";

Is there any way to resolve this warning?

sosoba commented 3 weeks ago

IMHO you should use CommonJS default import:

import oracledb from 'oracledb';

const { BIND_OUT, CLOB, STRING } = oracledb;
saphitv commented 3 weeks ago

Hi, unfortunately I had already tried this since I originally thought it was a problem with the import. I tried again now but the problem persists