Ignore TypeORM build warnings on NextJs

The fix:

    webpack(config) {

        const warning = [
            ...(config.ignoreWarnings || []),
            { module: /typeorm/ },
            { module: /app-root-path/, message: /the request of a dependency is an expression/ },
        ];
        config.ignoreWarnings = warning;

        return config;
    }

The warnings:

puncher on  master [!] via  v18.12.1 on ☁️  [redacted] took 28s 
❯ yarn build
yarn run v1.22.19
$ next build
- info Loaded env from /home/[redacted]/.env.local
- warn Compiled with warnings

./node_modules/app-root-path/lib/app-root-path.js
Critical dependency: the request of a dependency is an expression

Import trace for requested module:
./node_modules/app-root-path/lib/app-root-path.js
./node_modules/app-root-path/index.js
./node_modules/typeorm/logger/FileLogger.js
./node_modules/typeorm/index.js
./node_modules/typeorm/index.mjs
./node_modules/@auth/typeorm-adapter/index.js
./src/app/api/auth/[...nextauth]/route.ts

./node_modules/typeorm/connection/ConnectionOptionsReader.js
Critical dependency: the request of a dependency is an expression

Import trace for requested module:
./node_modules/typeorm/connection/ConnectionOptionsReader.js
./node_modules/typeorm/index.js
./node_modules/typeorm/index.mjs
./node_modules/@auth/typeorm-adapter/index.js
./src/app/api/auth/[...nextauth]/route.ts

./node_modules/typeorm/driver/react-native/ReactNativeDriver.js
Module not found: Can't resolve 'react-native-sqlite-storage' in '/home/[redacted]/node_modules/typeorm/driver/react-native'

Import trace for requested module:
./node_modules/typeorm/driver/react-native/ReactNativeDriver.js
./node_modules/typeorm/driver/DriverFactory.js
./node_modules/typeorm/data-source/DataSource.js
./node_modules/typeorm/index.js
./node_modules/typeorm/index.mjs
./node_modules/@auth/typeorm-adapter/index.js
./src/app/api/auth/[...nextauth]/route.ts

./node_modules/typeorm/platform/PlatformTools.js
Module not found: Can't resolve '@google-cloud/spanner' in '/home/[redacted]/node_modules/typeorm/platform'

Import trace for requested module:
./node_modules/typeorm/platform/PlatformTools.js
./node_modules/typeorm/globals.js
./node_modules/typeorm/index.js
./node_modules/typeorm/index.mjs
./node_modules/@auth/typeorm-adapter/index.js
./src/app/api/auth/[...nextauth]/route.ts

./node_modules/typeorm/platform/PlatformTools.js
Module not found: Can't resolve 'mongodb' in '/home/[redacted]/node_modules/typeorm/platform'

Import trace for requested module:
./node_modules/typeorm/platform/PlatformTools.js
./node_modules/typeorm/globals.js
./node_modules/typeorm/index.js
./node_modules/typeorm/index.mjs
./node_modules/@auth/typeorm-adapter/index.js
./src/app/api/auth/[...nextauth]/route.ts

./node_modules/typeorm/platform/PlatformTools.js
Module not found: Can't resolve '@sap/hana-client' in '/home/[redacted]/node_modules/typeorm/platform'

Import trace for requested module:
./node_modules/typeorm/platform/PlatformTools.js
./node_modules/typeorm/globals.js
./node_modules/typeorm/index.js
./node_modules/typeorm/index.mjs
./node_modules/@auth/typeorm-adapter/index.js
./src/app/api/auth/[...nextauth]/route.ts

./node_modules/typeorm/platform/PlatformTools.js
Module not found: Can't resolve 'hdb-pool' in '/home/[redacted]/node_modules/typeorm/platform'

Import trace for requested module:
./node_modules/typeorm/platform/PlatformTools.js
./node_modules/typeorm/globals.js
./node_modules/typeorm/index.js
./node_modules/typeorm/index.mjs
./node_modules/@auth/typeorm-adapter/index.js
./src/app/api/auth/[...nextauth]/route.ts

./node_modules/typeorm/platform/PlatformTools.js
Module not found: Can't resolve 'oracledb' in '/home/[redacted]/node_modules/typeorm/platform'

Import trace for requested module:
./node_modules/typeorm/platform/PlatformTools.js
./node_modules/typeorm/globals.js
./node_modules/typeorm/index.js
./node_modules/typeorm/index.mjs
./node_modules/@auth/typeorm-adapter/index.js
./src/app/api/auth/[...nextauth]/route.ts

./node_modules/typeorm/platform/PlatformTools.js
Module not found: Can't resolve 'pg' in '/home/[redacted]/node_modules/typeorm/platform'

Import trace for requested module:
./node_modules/typeorm/platform/PlatformTools.js
./node_modules/typeorm/globals.js
./node_modules/typeorm/index.js
./node_modules/typeorm/index.mjs
./node_modules/@auth/typeorm-adapter/index.js
./src/app/api/auth/[...nextauth]/route.ts

./node_modules/typeorm/platform/PlatformTools.js
Module not found: Can't resolve 'pg-native' in '/home/[redacted]/node_modules/typeorm/platform'

Import trace for requested module:
./node_modules/typeorm/platform/PlatformTools.js
./node_modules/typeorm/globals.js
./node_modules/typeorm/index.js
./node_modules/typeorm/index.mjs
./node_modules/@auth/typeorm-adapter/index.js
./src/app/api/auth/[...nextauth]/route.ts

./node_modules/typeorm/platform/PlatformTools.js
Module not found: Can't resolve 'pg-query-stream' in '/home/[redacted]/node_modules/typeorm/platform'

Import trace for requested module:
./node_modules/typeorm/platform/PlatformTools.js
./node_modules/typeorm/globals.js
./node_modules/typeorm/index.js
./node_modules/typeorm/index.mjs
./node_modules/@auth/typeorm-adapter/index.js
./src/app/api/auth/[...nextauth]/route.ts

./node_modules/typeorm/platform/PlatformTools.js
Module not found: Can't resolve 'typeorm-aurora-data-api-driver' in '/home/[redacted]/node_modules/typeorm/platform'

Import trace for requested module:
./node_modules/typeorm/platform/PlatformTools.js
./node_modules/typeorm/globals.js
./node_modules/typeorm/index.js
./node_modules/typeorm/index.mjs
./node_modules/@auth/typeorm-adapter/index.js
./src/app/api/auth/[...nextauth]/route.ts

./node_modules/typeorm/platform/PlatformTools.js
Module not found: Can't resolve 'redis' in '/home/[redacted]/node_modules/typeorm/platform'

Import trace for requested module:
./node_modules/typeorm/platform/PlatformTools.js
./node_modules/typeorm/globals.js
./node_modules/typeorm/index.js
./node_modules/typeorm/index.mjs
./node_modules/@auth/typeorm-adapter/index.js
./src/app/api/auth/[...nextauth]/route.ts

./node_modules/typeorm/platform/PlatformTools.js
Module not found: Can't resolve 'ioredis' in '/home/[redacted]/node_modules/typeorm/platform'

Import trace for requested module:
./node_modules/typeorm/platform/PlatformTools.js
./node_modules/typeorm/globals.js
./node_modules/typeorm/index.js
./node_modules/typeorm/index.mjs
./node_modules/@auth/typeorm-adapter/index.js
./src/app/api/auth/[...nextauth]/route.ts

./node_modules/typeorm/platform/PlatformTools.js
Module not found: Can't resolve 'better-sqlite3' in '/home/[redacted]/node_modules/typeorm/platform'

Import trace for requested module:
./node_modules/typeorm/platform/PlatformTools.js
./node_modules/typeorm/globals.js
./node_modules/typeorm/index.js
./node_modules/typeorm/index.mjs
./node_modules/@auth/typeorm-adapter/index.js
./src/app/api/auth/[...nextauth]/route.ts

./node_modules/typeorm/platform/PlatformTools.js
Module not found: Can't resolve 'sqlite3' in '/home/[redacted]/node_modules/typeorm/platform'

Import trace for requested module:
./node_modules/typeorm/platform/PlatformTools.js
./node_modules/typeorm/globals.js
./node_modules/typeorm/index.js
./node_modules/typeorm/index.mjs
./node_modules/@auth/typeorm-adapter/index.js
./src/app/api/auth/[...nextauth]/route.ts

./node_modules/typeorm/platform/PlatformTools.js
Module not found: Can't resolve 'sql.js' in '/home/[redacted]/node_modules/typeorm/platform'

Import trace for requested module:
./node_modules/typeorm/platform/PlatformTools.js
./node_modules/typeorm/globals.js
./node_modules/typeorm/index.js
./node_modules/typeorm/index.mjs
./node_modules/@auth/typeorm-adapter/index.js
./src/app/api/auth/[...nextauth]/route.ts

./node_modules/typeorm/platform/PlatformTools.js
Module not found: Can't resolve 'mssql' in '/home/[redacted]/node_modules/typeorm/platform'

Import trace for requested module:
./node_modules/typeorm/platform/PlatformTools.js
./node_modules/typeorm/globals.js
./node_modules/typeorm/index.js
./node_modules/typeorm/index.mjs
./node_modules/@auth/typeorm-adapter/index.js
./src/app/api/auth/[...nextauth]/route.ts

./node_modules/typeorm/platform/PlatformTools.js
Module not found: Can't resolve 'react-native-sqlite-storage' in '/home/[redacted]/node_modules/typeorm/platform'

Import trace for requested module:
./node_modules/typeorm/platform/PlatformTools.js
./node_modules/typeorm/globals.js
./node_modules/typeorm/index.js
./node_modules/typeorm/index.mjs
./node_modules/@auth/typeorm-adapter/index.js
./src/app/api/auth/[...nextauth]/route.ts

./node_modules/typeorm/platform/PlatformTools.js
Critical dependency: the request of a dependency is an expression

Import trace for requested module:
./node_modules/typeorm/platform/PlatformTools.js
./node_modules/typeorm/globals.js
./node_modules/typeorm/index.js
./node_modules/typeorm/index.mjs
./node_modules/@auth/typeorm-adapter/index.js
./src/app/api/auth/[...nextauth]/route.ts

./node_modules/typeorm/util/DirectoryExportedClassesLoader.js
Critical dependency: the request of a dependency is an expression

Import trace for requested module:
./node_modules/typeorm/util/DirectoryExportedClassesLoader.js
./node_modules/typeorm/connection/ConnectionMetadataBuilder.js
./node_modules/typeorm/data-source/DataSource.js
./node_modules/typeorm/index.js
./node_modules/typeorm/index.mjs
./node_modules/@auth/typeorm-adapter/index.js
./src/app/api/auth/[...nextauth]/route.ts

./node_modules/typeorm/util/ImportUtils.js
Critical dependency: the request of a dependency is an expression

Import trace for requested module:
./node_modules/typeorm/util/ImportUtils.js
./node_modules/typeorm/connection/ConnectionOptionsReader.js
./node_modules/typeorm/index.js
./node_modules/typeorm/index.mjs
./node_modules/@auth/typeorm-adapter/index.js
./src/app/api/auth/[...nextauth]/route.ts

Disclaimer:

Not all articles here are meant to be correct. My notes might be wrong or may no longer be relevant. If you want to try things here, please proceed with caution.


Posted

in

by

Tags: