question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Critical dependency: the request of a dependency is an expression

See original GitHub issue

Issue type:

[ x ] bug report [ ] feature request [ ] documentation issue

Database system/driver:

[ ] cordova [ ] mongodb [ x ] mssql [ ] mysql / mariadb [ ] oracle [ ] postgres [ ] cockroachdb [ ] sqlite [ ] sqljs [ ] react-native [ ] expo

TypeORM version:

[ ] latest [ ] @next [ x ] 0.3.0-alpha.24 (or put your version here)

Steps to reproduce or a small repository showing the problem: I’m simply trying to run unit tests using mocha-webpack and I’m getting some strange warnings when typeorm is being imported into my .ts file… So I have a simple TypeScript class, and I’m getting the following warnings when I try to import import {LessThanOrEqual} from 'typeorm', and my tests are unable to continue.

I also tried following this suggestion, but the warnings are still happening: https://github.com/typeorm/typeorm/blob/master/docs/faq.md#how-to-use-webpack-for-the-backend

Here are the warnings ( i know it says 14 warnings, but one should suffice): ` WEBPACK Compiling…

WEBPACK Compiled with 14 warning(s)

Warning in ./stacks/rds/node_modules/.pnpm/registry.npmjs.org/typeorm/0.3.0-alpha.24/node_modules/typeorm/platform/PlatformTools.js

107:27-40 Critical dependency: the request of a dependency is an expression`

Here is the rest of the output after the warnings, not sure this helps or not: `MOCHA Testing…

RUNTIME EXCEPTION Exception occurred while loading your tests

TypeError: chalk_1.default.Instance is not a constructor at eval (webpack-internal:///82:12:13) at Object.<anonymous> (/some/root/directory/.tmp/mocha-webpack/1600196505474/bundle.js:641:1) at webpack_require (/some/root/directory/.tmp/mocha-webpack/1600196505474/bundle.js:20:30) at eval (webpack-internal:///128:19:15) at Object.<anonymous> (/some/root/directory/.tmp/mocha-webpack/1600196505474/bundle.js:950:1) at webpack_require (/some/root/directory/.tmp/mocha-webpack/1600196505474/bundle.js:20:30) at eval (webpack-internal:///3:6:23) at Object.<anonymous> (/some/root/directory/.tmp/mocha-webpack/1600196505474/bundle.js:91:1) at webpack_require (/some/root/directory/.tmp/mocha-webpack/1600196505474/bundle.js:20:30) at eval (webpack-internal:///5:9:23) at Object.<anonymous> (/some/root/directory/.tmp/mocha-webpack/1600196505474/bundle.js:105:1) at webpack_require (/some/root/directory/.tmp/mocha-webpack/1600196505474/bundle.js:20:30) at eval (webpack-internal:///125:7:25) at Object.<anonymous> (/some/root/directory/.tmp/mocha-webpack/1600196505474/bundle.js:929:1) at webpack_require (/some/root/directory/.tmp/mocha-webpack/1600196505474/bundle.js:20:30) at eval (webpack-internal:///72:8:27) at Object.<anonymous> (/some/root/directory/.tmp/mocha-webpack/1600196505474/bundle.js:572:1) at webpack_require (/some/root/directory/.tmp/mocha-webpack/1600196505474/bundle.js:20:30) at eval (webpack-internal:///71:3:20) at Object.<anonymous> (/some/root/directory/.tmp/mocha-webpack/1600196505474/bundle.js:565:1) at webpack_require (/some/root/directory/.tmp/mocha-webpack/1600196505474/bundle.js:20:30) at eval (webpack-internal:///1:7:27) at Object.<anonymous> (/some/root/directory/.tmp/mocha-webpack/1600196505474/bundle.js:77:1) at webpack_require (/some/root/directory/.tmp/mocha-webpack/1600196505474/bundle.js:20:30) at eval (webpack-internal:///119:30:19) at Object.<anonymous> (/some/root/directory/.tmp/mocha-webpack/1600196505474/bundle.js:889:1) at webpack_require (/some/root/directory/.tmp/mocha-webpack/1600196505474/bundle.js:20:30) at eval (webpack-internal:///109:39:24) at Object.<anonymous> (/some/root/directory/.tmp/mocha-webpack/1600196505474/bundle.js:827:1) at webpack_require (/some/root/directory/.tmp/mocha-webpack/1600196505474/bundle.js:20:30) at run (webpack-internal:///108:3:20) at Array.forEach (<anonymous>) at eval (webpack-internal:///108:10:24) at Object.<anonymous> (/some/root/directory/.tmp/mocha-webpack/1600196505474/bundle.js:820:1) at webpack_require (/some/root/directory/.tmp/mocha-webpack/1600196505474/bundle.js:20:30) at /some/root/directory/.tmp/mocha-webpack/1600196505474/bundle.js:63:18 at Object.<anonymous> (/some/root/directory/.tmp/mocha-webpack/1600196505474/bundle.js:66:10) at Module._compile (internal/modules/cjs/loader.js:776:30) at Object._module2.default._extensions.(anonymous function) [as .js] (/some/root/directory/node_modules/mocha-webpack/lib/util/registerRequireHook.js:147:12) at Module.load (internal/modules/cjs/loader.js:653:32) at tryModuleLoad (internal/modules/cjs/loader.js:593:12) at Function.Module._load (internal/modules/cjs/loader.js:585:3) at Module.require (internal/modules/cjs/loader.js:690:17) at require (internal/modules/cjs/helpers.js:25:18) at /some/root/directory/node_modules/mocha/lib/mocha.js:231:27 at Array.forEach (<anonymous>) at Mocha.loadFiles (/some/root/directory/node_modules/mocha/lib/mocha.js:228:14) at Mocha.run (/some/root/directory/node_modules/mocha/lib/mocha.js:536:10) at /some/root/directory/node_modules/mocha-webpack/lib/runner/TestRunner.js:196:25 at Compiler.<anonymous> (/some/root/directory/node_modules/mocha-webpack/lib/webpack/compiler/registerReadyCallback.js:26:7) at Compiler.applyPlugins (/some/root/directory/node_modules/tapable/lib/Tapable.js:61:14) at emitRecords.err (/some/root/directory/node_modules/webpack/lib/Compiler.js:264:11) at Compiler.emitRecords (/some/root/directory/node_modules/webpack/lib/Compiler.js:371:38) at emitAssets.err (/some/root/directory/node_modules/webpack/lib/Compiler.js:258:10) at applyPluginsAsyncSeries1.err (/some/root/directory/node_modules/webpack/lib/Compiler.js:364:12) at next (/some/root/directory/node_modules/tapable/lib/Tapable.js:218:11) at Compiler.compiler.plugin (/some/root/directory/node_modules/webpack/lib/performance/SizeLimitsPlugin.js:99:4) at Compiler.applyPluginsAsyncSeries1 (/some/root/directory/node_modules/tapable/lib/Tapable.js:222:13) at Compiler.afterEmit (/some/root/directory/node_modules/webpack/lib/Compiler.js:361:9) at require.forEach.err (/some/root/directory/node_modules/webpack/lib/Compiler.js:350:15) at /some/root/directory/node_modules/webpack/node_modules/async/dist/async.js:473:16 at iteratorCallback (/some/root/directory/node_modules/webpack/node_modules/async/dist/async.js:1064:13) at /some/root/directory/node_modules/webpack/node_modules/async/dist/async.js:969:16 at MemoryFileSystem.writeFile (/some/root/directory/node_modules/memory-fs/lib/MemoryFileSystem.js:328:9) at writeOut (/some/root/directory/node_modules/webpack/lib/Compiler.js:339:28) at require.forEach (/some/root/directory/node_modules/webpack/lib/Compiler.js:345:12) at /some/root/directory/node_modules/webpack/node_modules/async/dist/async.js:3110:16 at eachOfArrayLike (/some/root/directory/node_modules/webpack/node_modules/async/dist/async.js:1069:9) at eachOf (/some/root/directory/node_modules/webpack/node_modules/async/dist/async.js:1117:5) at Object.eachLimit (/some/root/directory/node_modules/webpack/node_modules/async/dist/async.js:3172:5) at emitFiles (/some/root/directory/node_modules/webpack/lib/Compiler.js:315:21) at Immediate._onImmediate (/some/root/directory/node_modules/memory-fs/lib/MemoryFileSystem.js:288:4) at runCallback (timers.js:705:18) at tryOnImmediate (timers.js:676:5) at processImmediate (timers.js:658:5)

Process finished with exit code 1`

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:9 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
imnotjamescommented, Aug 11, 2021

Isn’t that a warning, though?

This is because webpack cannot during compile-time figure out what we’re importing because it’s an expression that is only known during runtime.

That’s because we’re using require to load our configuration files through that class.

I think that’s unrelated to the problem described in this issue - even if it’s got a similar message.

However, if you think that’s a bug please open a new issue.

1reaction
MichaelSpcommented, Dec 19, 2020

still present in "typeorm": "^0.3.0-rc.21" and "typeorm": "^0.3.0-alpha.24" BTW: This is not related to mssql

Read more comments on GitHub >

github_iconTop Results From Across the Web

Webpack - Critical dependency: the request of a dependency ...
Webpack - Critical dependency: the request of a dependency is an expression · Manually configure webpack to import the required libraries and ...
Read more >
Webpack Warning: Critical dependency: the request of a ...
[Edit: This seems to be related with WebPack in General, not with Angular] When activating this module in an Angular 12 project, this...
Read more >
the request of a dependency is an expression - You.com
Critical dependency: the request of a dependency is an expression -- react-universal-component · Webpack - Critical dependency: the request of a dependency is...
Read more >
the request of a dependency is an expression - Get Help
When I use “require( )” inside a v-bind:src directive, I get “the warning Critical dependency: the request of a dependency is an expression” ......
Read more >
Webpack - the request of a dependency is an expression
Webpack – Critical dependency: the request of a dependency is an expression · Manually configure webpack to import the required libraries and prevent...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found