You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Get this critical error when building a Dynamoose project with a Next.JS Typescript project.
./node_modules/dynamoose/dist/utils/importPackage.js
Critical dependency: the request of a dependency is an expression
Import trace for requested module:
./node_modules/dynamoose/dist/utils/importPackage.js
./node_modules/dynamoose/dist/utils/index.js
./node_modules/dynamoose/dist/index.js
...
While this dosesn't cause any runtime issues, it still throws a critical dependency warning at build time
Current output and behavior (including stack trace):
./node_modules/dynamoose/dist/utils/importPackage.js
Critical dependency: the request of a dependency is an expression
Import trace for requested module:
./node_modules/dynamoose/dist/utils/importPackage.js
./node_modules/dynamoose/dist/utils/index.js
./node_modules/dynamoose/dist/index.js
...
It seems to be related to how dynamoose imports dynamoose-logger via non-static require(name) call, and because Next.js uses webpack (which requires static imports to bundle the code), the error comes from it.
/** @type {import('next').NextConfig} */
const config = {
...
experimental: {
// Next.js is getting issues trying to compile dynamoose, so need to opt-out it from bundling
serverComponentsExternalPackages: ['dynamoose'],
},
};
Summary:
Get this critical error when building a Dynamoose project with a Next.JS Typescript project.
Code sample:
Schema
Model
General
While this dosesn't cause any runtime issues, it still throws a critical dependency warning at build time
Current output and behavior (including stack trace):
Expected output and behavior:
No errors on building a next project
Environment:
Operating System: MacOS
Operating System Version: Ventura 13.1
Node.js version (
node -v
): v20.2.0NPM version: (
npm -v
): 9.6.6Dynamoose version: 3.2.0
Other information (if applicable):
Other:
The text was updated successfully, but these errors were encountered: