NX NestJS Angular,为什么 Ivy 抱怨不属于前端应用程序的模块?

NX NestJS Angular, Why is Ivy complaining about modules that are not part of the frontend app?

各位开发者大家好!

所以我开发这个应用程序已经有一段时间了。我喜欢与我使用的框架保持同步,所以我会在框架发布新版本时定期更新。即 Angular 9 > 10。Angular 10 > 11。

所以我最近更新到 Angular 11 并更新了我的 nestjs 和 nx。现在,当我尝试为我的前端应用程序提供服务时,Ivy 似乎抱怨很多......但是......很多......关于前端应用程序中未使用的模块。

Warning: ./node_modules/@nestjs/common/utils/load-package.util.js 9:39-59
Critical dependency: the request of a dependency is an expression

Warning: ./node_modules/@nestjs/core/helpers/optional-require.js 6:39-59
Critical dependency: the request of a dependency is an expression

Warning: ./node_modules/@nestjs/core/helpers/load-adapter.js 9:39-63
Critical dependency: the request of a dependency is an expression

Warning: ./node_modules/express/lib/view.js 81:13-25
Critical dependency: the request of a dependency is an expression

Warning: /Users/user/Projects/workspace/libs/stacks-dto/src/lib/user.dto.ts depends on '@nestjs/mongoose'. CommonJS or AMD dependencies can cause optimization bailouts.
For more info see: https://angular.io/guide/build#configuring-commonjs-dependencies

Warning: /Users/user/Projects/workspace/node_modules/class-validator/esm2015/decorator/string/IsRgbColor.js depends on 'validator/lib/isRgbColor'. CommonJS or AMD dependencies can cause optimization bailouts.
For more info see: https://angular.io/guide/build#configuring-commonjs-dependencies

Warning: /Users/user/Projects/workspace/node_modules/class-validator/esm2015/decorator/string/IsPostalCode.js depends on 'validator/lib/isPostalCode'. CommonJS or AMD dependencies can cause optimization bailouts.
For more info see: https://angular.io/guide/build#configuring-commonjs-dependencies

Warning: /Users/user/Projects/workspace/node_modules/class-validator/esm2015/decorator/string/IsSemVer.js depends on 'validator/lib/isSemVer'. CommonJS or AMD dependencies can cause optimization bailouts.
For more info see: https://angular.io/guide/build#configuring-commonjs-dependencies

Warning: /Users/user/Projects/workspace/node_modules/class-validator/esm2015/decorator/string/IsRFC3339.js depends on 'validator/lib/isRFC3339'. CommonJS or AMD dependencies can cause optimization bailouts.
For more info see: https://angular.io/guide/build#configuring-commonjs-dependencies

Warning: /Users/user/Projects/workspace/node_modules/class-validator/esm2015/decorator/string/IsOctal.js depends on 'validator/lib/isOctal'. CommonJS or AMD dependencies can cause optimization bailouts.
For more info see: https://angular.io/guide/build#configuring-commonjs-dependencies

Warning: /Users/user/Projects/workspace/node_modules/class-validator/esm2015/decorator/string/IsLocale.js depends on 'validator/lib/isLocale'. CommonJS or AMD dependencies can cause optimization bailouts.
For more info see: https://angular.io/guide/build#configuring-commonjs-dependencies

Warning: /Users/user/Projects/workspace/node_modules/class-validator/esm2015/decorator/string/IsMagnetURI.js depends on 'validator/lib/isMagnetURI'. CommonJS or AMD dependencies can cause optimization bailouts.
For more info see: https://angular.io/guide/build#configuring-commonjs-dependencies

Warning: /Users/user/Projects/workspace/node_modules/class-validator/esm2015/decorator/string/IsPassportNumber.js depends on 'validator/lib/isPassportNumber'. CommonJS or AMD dependencies can cause optimization bailouts.
For more info see: https://angular.io/guide/build#configuring-commonjs-dependencies

Warning: /Users/user/Projects/workspace/node_modules/class-validator/esm2015/decorator/string/IsMimeType.js depends on 'validator/lib/isMimeType'. CommonJS or AMD dependencies can cause optimization bailouts.
For more info see: https://angular.io/guide/build#configuring-commonjs-dependencies

Warning: /Users/user/Projects/workspace/node_modules/class-validator/esm2015/decorator/string/IsISRC.js depends on 'validator/lib/isISRC'. CommonJS or AMD dependencies can cause optimization bailouts.
For more info see: https://angular.io/guide/build#configuring-commonjs-dependencies

Warning: /Users/user/Projects/workspace/node_modules/class-validator/esm2015/decorator/string/IsIdentityCard.js depends on 'validator/lib/isIdentityCard'. CommonJS or AMD dependencies can cause optimization bailouts.
For more info see: https://angular.io/guide/build#configuring-commonjs-dependencies

Warning: /Users/user/Projects/workspace/node_modules/class-validator/esm2015/decorator/string/IsIBAN.js depends on 'validator/lib/isIBAN'. CommonJS or AMD dependencies can cause optimization bailouts.
For more info see: https://angular.io/guide/build#configuring-commonjs-dependencies

Warning: /Users/user/Projects/workspace/node_modules/class-validator/esm2015/decorator/string/IsEthereumAddress.js depends on 'validator/lib/isEthereumAddress'. CommonJS or AMD dependencies can cause optimization bailouts.
For more info see: https://angular.io/guide/build#configuring-commonjs-dependencies

Warning: /Users/user/Projects/workspace/node_modules/class-validator/esm2015/decorator/string/IsHSL.js depends on 'validator/lib/isHSL'. CommonJS or AMD dependencies can cause optimization bailouts.
For more info see: https://angular.io/guide/build#configuring-commonjs-dependencies

Warning: /Users/user/Projects/workspace/node_modules/class-validator/esm2015/decorator/string/IsEAN.js depends on 'validator/lib/isEAN'. CommonJS or AMD dependencies can cause optimization bailouts.
For more info see: https://angular.io/guide/build#configuring-commonjs-dependencies

Warning: /Users/user/Projects/workspace/node_modules/class-validator/esm2015/decorator/string/IsBtcAddress.js depends on 'validator/lib/isBtcAddress'. CommonJS or AMD dependencies can cause optimization bailouts.
For more info see: https://angular.io/guide/build#configuring-commonjs-dependencies

Warning: /Users/user/Projects/workspace/node_modules/class-validator/esm2015/decorator/string/IsDataURI.js depends on 'validator/lib/isDataURI'. CommonJS or AMD dependencies can cause optimization bailouts.
For more info see: https://angular.io/guide/build#configuring-commonjs-dependencies

Warning: /Users/user/Projects/workspace/node_modules/class-validator/esm2015/decorator/string/IsBIC.js depends on 'validator/lib/isBIC'. CommonJS or AMD dependencies can cause optimization bailouts.
For more info see: https://angular.io/guide/build#configuring-commonjs-dependencies

Warning: /Users/user/Projects/workspace/node_modules/class-validator/esm2015/decorator/string/IsNumberString.js depends on 'validator/lib/isNumeric'. CommonJS or AMD dependencies can cause optimization bailouts.
For more info see: https://angular.io/guide/build#configuring-commonjs-dependencies

Warning: /Users/user/Projects/workspace/node_modules/class-validator/esm2015/decorator/string/IsBase32.js depends on 'validator/lib/isBase32'. CommonJS or AMD dependencies can cause optimization bailouts.
For more info see: https://angular.io/guide/build#configuring-commonjs-dependencies

Warning: /Users/user/Projects/workspace/node_modules/class-validator/esm2015/decorator/string/IsBooleanString.js depends on 'validator/lib/isBoolean'. CommonJS or AMD dependencies can cause optimization bailouts.
For more info see: https://angular.io/guide/build#configuring-commonjs-dependencies

Warning: /Users/user/Projects/workspace/node_modules/class-validator/esm2015/decorator/string/IsISSN.js depends on 'validator/lib/isISSN'. CommonJS or AMD dependencies can cause optimization bailouts.
For more info see: https://angular.io/guide/build#configuring-commonjs-dependencies

Warning: /Users/user/Projects/workspace/node_modules/class-validator/esm2015/decorator/string/IsHash.js depends on 'validator/lib/isHash'. CommonJS or AMD dependencies can cause optimization bailouts.
For more info see: https://angular.io/guide/build#configuring-commonjs-dependencies

Warning: /Users/user/Projects/workspace/node_modules/class-validator/esm2015/decorator/string/IsMilitaryTime.js depends on 'validator/lib/matches'. CommonJS or AMD dependencies can cause optimization bailouts.
For more info see: https://angular.io/guide/build#configuring-commonjs-dependencies

Warning: /Users/user/Projects/workspace/node_modules/class-validator/esm2015/decorator/string/MinLength.js depends on 'validator/lib/isLength'. CommonJS or AMD dependencies can cause optimization bailouts.
For more info see: https://angular.io/guide/build#configuring-commonjs-dependencies

Warning: /Users/user/Projects/workspace/node_modules/class-validator/esm2015/decorator/string/IsUUID.js depends on 'validator/lib/isUUID'. CommonJS or AMD dependencies can cause optimization bailouts.
For more info see: https://angular.io/guide/build#configuring-commonjs-dependencies

Warning: /Users/user/Projects/workspace/node_modules/class-validator/esm2015/decorator/string/IsUppercase.js depends on 'validator/lib/isUppercase'. CommonJS or AMD dependencies can cause optimization bailouts.
For more info see: https://angular.io/guide/build#configuring-commonjs-dependencies

Warning: /Users/user/Projects/workspace/node_modules/class-validator/esm2015/decorator/string/IsMongoId.js depends on 'validator/lib/isMongoId'. CommonJS or AMD dependencies can cause optimization bailouts.
For more info see: https://angular.io/guide/build#configuring-commonjs-dependencies

Warning: /Users/user/Projects/workspace/node_modules/class-validator/esm2015/decorator/string/IsUrl.js depends on 'validator/lib/isURL'. CommonJS or AMD dependencies can cause optimization bailouts.
For more info see: https://angular.io/guide/build#configuring-commonjs-dependencies

Warning: /Users/user/Projects/workspace/node_modules/class-validator/esm2015/decorator/string/IsMultibyte.js depends on 'validator/lib/isMultibyte'. CommonJS or AMD dependencies can cause optimization bailouts.
For more info see: https://angular.io/guide/build#configuring-commonjs-dependencies

Warning: /Users/user/Projects/workspace/node_modules/class-validator/esm2015/decorator/string/IsSurrogatePair.js depends on 'validator/lib/isSurrogatePair'. CommonJS or AMD dependencies can cause optimization bailouts.
For more info see: https://angular.io/guide/build#configuring-commonjs-dependencies

Warning: /Users/user/Projects/workspace/node_modules/class-validator/esm2015/decorator/string/IsISO31661Alpha3.js depends on 'validator/lib/isISO31661Alpha3'. CommonJS or AMD dependencies can cause optimization bailouts.
For more info see: https://angular.io/guide/build#configuring-commonjs-dependencies

Warning: /Users/user/Projects/workspace/node_modules/class-validator/esm2015/decorator/string/IsISO31661Alpha2.js depends on 'validator/lib/isISO31661Alpha2'. CommonJS or AMD dependencies can cause optimization bailouts.
For more info see: https://angular.io/guide/build#configuring-commonjs-dependencies

Warning: /Users/user/Projects/workspace/node_modules/class-validator/esm2015/decorator/string/IsMobilePhone.js depends on 'validator/lib/isMobilePhone'. CommonJS or AMD dependencies can cause optimization bailouts.
For more info see: https://angular.io/guide/build#configuring-commonjs-dependencies

[39[39mmWarning: /Users/user/Projects/workspace/node_modules/class-validator/esm2015/decorator/string/IsJWT.js depends on 'validator/lib/isJWT'. CommonJS or AMD dependencies can cause optimization bailouts.
For more info see: https://angular.io/guide/build#configuring-commonjs-dependencies

Warning: /Users/user/Projects/workspace/node_modules/class-validator/esm2015/decorator/string/IsLowercase.js depends on 'validator/lib/isLowercase'. CommonJS or AMD dependencies can cause optimization bailouts.
For more info see: https://angular.io/guide/build#configuring-commonjs-dependencies

Warning: /Users/user/Projects/workspace/node_modules/class-validator/esm2015/decorator/string/IsJSON.js depends on 'validator/lib/isJSON'. CommonJS or AMD dependencies can cause optimization bailouts.
For more info see: https://angular.io/guide/build#configuring-commonjs-dependencies

Warning: /Users/user/Projects/workspace/node_modules/class-validator/esm2015/decorator/string/IsISO8601.js depends on 'validator/lib/isISO8601'. CommonJS or AMD dependencies can cause optimization bailouts.
For more info see: https://angular.io/guide/build#configuring-commonjs-dependencies

Warning: /Users/user/Projects/workspace/node_modules/class-validator/esm2015/decorator/string/IsISIN.js depends on 'validator/lib/isISIN'. CommonJS or AMD dependencies can cause optimization bailouts.
For more info see: https://angular.io/guide/build#configuring-commonjs-dependencies

Warning: /Users/user/Projects/workspace/node_modules/class-validator/esm2015/decorator/string/IsISBN.js depends on 'validator/lib/isISBN'. CommonJS or AMD dependencies can cause optimization bailouts.
For more info see: https://angular.io/guide/build#configuring-commonjs-dependencies

Warning: /Users/user/Projects/workspace/node_modules/class-validator/esm2015/decorator/string/IsPort.js depends on 'validator/lib/isPort'. CommonJS or AMD dependencies can cause optimization bailouts.
For more info see: https://angular.io/guide/build#configuring-commonjs-dependencies

Warning: /Users/user/Projects/workspace/node_modules/class-validator/esm2015/decorator/string/IsIP.js depends on 'validator/lib/isIP'. CommonJS or AMD dependencies can cause optimization bailouts.
For more info see: https://angular.io/guide/build#configuring-commonjs-dependencies

Warning: /Users/user/Projects/workspace/node_modules/class-validator/esm2015/decorator/string/IsHexColor.js depends on 'validator/lib/isHexColor'. CommonJS or AMD dependencies can cause optimization bailouts.
For more info see: https://angular.io/guide/build#configuring-commonjs-dependencies

Warning: /Users/user/Projects/workspace/node_modules/class-validator/esm2015/decorator/string/IsHexadecimal.js depends on 'validator/lib/isHexadecimal'. CommonJS or AMD dependencies can cause optimization bailouts.
For more info see: https://angular.io/guide/build#configuring-commonjs-dependencies

Warning: /Users/user/Projects/workspace/node_modules/class-validator/esm2015/decorator/string/IsVariableWidth.js depends on 'validator/lib/isVariableWidth'. CommonJS or AMD dependencies can cause optimization bailouts.
For more info see: https://angular.io/guide/build#configuring-commonjs-dependencies

Warning: /Users/user/Projects/workspace/node_modules/class-validator/esm2015/decorator/string/IsMacAddress.js depends on 'validator/lib/isMACAddress'. CommonJS or AMD dependencies can cause optimization bailouts.
For more info see: https://angular.io/guide/build#configuring-commonjs-dependencies

Warning: /Users/user/Projects/workspace/node_modules/class-validator/esm2015/decorator/string/IsHalfWidth.js depends on 'validator/lib/isHalfWidth'. CommonJS or AMD dependencies can cause optimization bailouts.
For more info see: https://angular.io/guide/build#configuring-commonjs-dependencies

Warning: /Users/user/Projects/workspace/node_modules/class-validator/esm2015/decorator/string/IsFQDN.js depends on 'validator/lib/isFQDN'. CommonJS or AMD dependencies can cause optimization bailouts.
For more info see: https://angular.io/guide/build#configuring-commonjs-dependencies

Warning: /Users/user/Projects/workspace/node_modules/class-validator/esm2015/decorator/string/IsEmail.js depends on 'validator/lib/isEmail'. CommonJS or AMD dependencies can cause optimization bailouts.
For more info see: https://angular.io/guide/build#configuring-commonjs-dependencies

Warning: /Users/user/Projects/workspace/node_modules/class-validator/esm2015/decorator/string/IsCreditCard.js depends on 'validator/lib/isCreditCard'. CommonJS or AMD dependencies can cause optimization bailouts.
For more info see: https://angular.io/guide/build#configuring-commonjs-dependencies

[9[39m3mWarning: /Users/user/Projects/workspace/node_modules/class-validator/esm2015/decorator/string/IsByteLength.js depends on 'validator/lib/isByteLength'. CommonJS or AMD dependencies can cause optimization bailouts.
For more info see: https://angular.io/guide/build#configuring-commonjs-dependencies

Warning: /Users/user/Projects/workspace/node_modules/class-validator/esm2015/decorator/string/IsFullWidth.js depends on 'validator/lib/isFullWidth'. CommonJS or AMD dependencies can cause optimization bailouts.
For more info see: https://angular.io/guide/build#configuring-commonjs-dependencies

Warning: /Users/user/Projects/workspace/node_modules/class-validator/esm2015/decorator/string/IsCurrency.js depends on 'validator/lib/isCurrency'. CommonJS or AMD dependencies can cause optimization bailouts.
For more info see: https://angular.io/guide/build#configuring-commonjs-dependencies

Warning: /Users/user/Projects/workspace/node_modules/class-validator/esm2015/decorator/string/NotContains.js depends on 'validator/lib/contains'. CommonJS or AMD dependencies can cause optimization bailouts.
For more info see: https://angular.io/guide/build#configuring-commonjs-dependencies

Warning: /Users/user/Projects/workspace/node_modules/class-validator/esm2015/decorator/string/IsBase64.js depends on 'validator/lib/isBase64'. CommonJS or AMD dependencies can cause optimization bailouts.
For more info see: https://angular.io/guide/build#configuring-commonjs-dependencies

Warning: /Users/user/Projects/workspace/node_modules/class-validator/esm2015/decorator/string/IsDecimal.js depends on 'validator/lib/isDecimal'. CommonJS or AMD dependencies can cause optimization bailouts.
For more info see: https://angular.io/guide/build#configuring-commonjs-dependencies

Warning: /Users/user/Projects/workspace/node_modules/class-validator/esm2015/decorator/string/IsAlpha.js depends on 'validator/lib/isAlpha'. CommonJS or AMD dependencies can cause optimization bailouts.
For more info see: https://angular.io/guide/build#configuring-commonjs-dependencies

Warning: /Users/user/Projects/workspace/node_modules/class-validator/esm2015/decorator/string/IsAscii.js depends on 'validator/lib/isAscii'. CommonJS or AMD dependencies can cause optimization bailouts.
For more info see: https://angular.io/guide/build#configuring-commonjs-dependencies

Warning: /Users/user/Projects/workspace/node_modules/class-validator/esm2015/decorator/string/IsAlphanumeric.js depends on 'validator/lib/isAlphanumeric'. CommonJS or AMD dependencies can cause optimization bailouts.
For more info see: https://angular.io/guide/build#configuring-commonjs-dependencies

Warning: /Users/user/Projects/workspace/node_modules/class-validator/esm2015/decorator/number/IsDivisibleBy.js depends on 'validator/lib/isDivisibleBy'. CommonJS or AMD dependencies can cause optimization bailouts.
For more info see: https://angular.io/guide/build#configuring-commonjs-dependencies

Warning: /Users/user/Projects/workspace/node_modules/class-validator/esm2015/decorator/common/IsLatLong.js depends on 'validator/lib/isLatLong'. CommonJS or AMD dependencies can cause optimization bailouts.
For more info see: https://angular.io/guide/build#configuring-commonjs-dependencies



Error: ./node_modules/@nestjs/microservices/client/client-rmq.js
Module not found: Error: Can't resolve 'amqp-connection-manager' in '/Users/user/Projects/workspace/node_modules/@nestjs/microservices/client'

Error: ./node_modules/@nestjs/microservices/server/server-rmq.js
Module not found: Error: Can't resolve 'amqp-connection-manager' in '/Users/user/Projects/workspace/node_modules/@nestjs/microservices/server'

Error: ./node_modules/@nestjs/microservices/client/client-rmq.js
Module not found: Error: Can't resolve 'amqplib' in '/Users/user/Projects/workspace/node_modules/@nestjs/microservices/client'

Error: ./node_modules/@nestjs/microservices/server/server-rmq.js
Module not found: Error: Can't resolve 'amqplib' in '/Users/user/Projects/workspace/node_modules/@nestjs/microservices/server'

Error: ./node_modules/@nestjs/common/cache/cache.providers.js
Module not found: Error: Can't resolve 'cache-manager' in '/Users/user/Projects/workspace/node_modules/@nestjs/common/cache'

Error: ./node_modules/cookie-signature/index.js
Module not found: Error: Can't resolve 'crypto' in '/Users/user/Projects/workspace/node_modules/cookie-signature'

Error: ./node_modules/etag/index.js
Module not found: Error: Can't resolve 'crypto' in '/Users/user/Projects/workspace/node_modules/etag'

Error: ./node_modules/multer/storage/disk.js
Module not found: Error: Can't resolve 'crypto' in '/Users/user/Projects/workspace/node_modules/multer/storage'

Error: ./node_modules/busboy/lib/main.js
Module not found: Error: Can't resolve 'fs' in '/Users/user/Projects/workspace/node_modules/busboy/lib'

Error: ./node_modules/destroy/index.js
Module not found: Error: Can't resolve 'fs' in '/Users/user/Projects/workspace/node_modules/destroy'

Error: ./node_modules/etag/index.js
Module not found: Error: Can't resolve 'fs' in '/Users/user/Projects/workspace/node_modules/etag'

Error: ./node_modules/express/lib/view.js
Module not found: Error: Can't resolve 'fs' in '/Users/user/Projects/workspace/node_modules/express/lib'

Error: ./node_modules/mime/mime.js
Module not found: Error: Can't resolve 'fs' in '/Users/user/Projects/workspace/node_modules/mime'

Error: ./node_modules/mkdirp/index.js
Module not found: Error: Can't resolve 'fs' in '/Users/user/Projects/workspace/node_modules/mkdirp'

Error: ./node_modules/multer/storage/disk.js
Module not found: Error: Can't resolve 'fs' in '/Users/user/Projects/workspace/node_modules/multer/storage'

Error: ./node_modules/send/index.js
Module not found: Error: Can't resolve 'fs' in '/Users/user/Projects/workspace/node_modules/send'

Error: ./node_modules/@nestjs/microservices/client/client-grpc.js
Module not found: Error: Can't resolve 'grpc' in '/Users/user/Projects/workspace/node_modules/@nestjs/microservices/client'

Error: ./node_modules/@nestjs/microservices/server/server-grpc.js
Module not found: Error: Can't resolve 'grpc' in '/Users/user/Projects/workspace/node_modules/@nestjs/microservices/server'

Error: ./node_modules/@nestjs/platform-express/adapters/express-adapter.js
Module not found: Error: Can't resolve 'http' in '/Users/user/Projects/workspace/node_modules/@nestjs/platform-express/adapters'

Error: ./node_modules/express/lib/response.js
Module not found: Error: Can't resolve 'http' in '/Users/user/Projects/workspace/node_modules/express/lib'

Error: ./node_modules/express/lib/request.js
Module not found: Error: Can't resolve 'http' in '/Users/user/Projects/workspace/node_modules/express/lib'

Error: ./node_modules/express/lib/application.js
Module not found: Error: Can't resolve 'http' in '/Users/user/Projects/workspace/node_modules/express/lib'

Error: ./node_modules/@nestjs/platform-express/adapters/express-adapter.js
Module not found: Error: Can't resolve 'https' in '/Users/user/Projects/workspace/node_modules/@nestjs/platform-express/adapters'

Error: ./node_modules/@nestjs/microservices/client/client-kafka.js
Module not found: Error: Can't resolve 'kafkajs' in '/Users/user/Projects/workspace/node_modules/@nestjs/microservices/client'

Error: ./node_modules/@nestjs/microservices/helpers/kafka-reply-partition-assigner.js
Module not found: Error: Can't resolve 'kafkajs' in '/Users/user/Projects/workspace/node_modules/@nestjs/microservices/helpers'

Error: ./node_modules/@nestjs/microservices/server/server-kafka.js
Module not found: Error: Can't resolve 'kafkajs' in '/Users/user/Projects/workspace/node_modules/@nestjs/microservices/server'

Error: ./node_modules/@nestjs/microservices/client/client-mqtt.js
Module not found: Error: Can't resolve 'mqtt' in '/Users/user/Projects/workspace/node_modules/@nestjs/microservices/client'

Error: ./node_modules/@nestjs/microservices/server/server-mqtt.js
Module not found: Error: Can't resolve 'mqtt' in '/Users/user/Projects/workspace/node_modules/@nestjs/microservices/server'

Error: ./node_modules/@nestjs/microservices/client/client-nats.js
Module not found: Error: Can't resolve 'nats' in '/Users/user/Projects/workspace/node_modules/@nestjs/microservices/client'

Error: ./node_modules/@nestjs/microservices/server/server-nats.js
Module not found: Error: Can't resolve 'nats' in '/Users/user/Projects/workspace/node_modules/@nestjs/microservices/server'

Error: ./node_modules/@nestjs/microservices/client/client-tcp.js
Module not found: Error: Can't resolve 'net' in '/Users/user/Projects/workspace/node_modules/@nestjs/microservices/client'

Error: ./node_modules/@nestjs/microservices/server/server-tcp.js
Module not found: Error: Can't resolve 'net' in '/Users/user/Projects/workspace/node_modules/@nestjs/microservices/server'

Error: ./node_modules/express/lib/request.js
Module not found: Error: Can't resolve 'net' in '/Users/user/Projects/workspace/node_modules/express/lib'

Error: ./node_modules/@nestjs/core/nest-application.js
Module not found: Error: Can't resolve 'os' in '/Users/user/Projects/workspace/node_modules/@nestjs/core'

Error: ./node_modules/multer/storage/disk.js
Module not found: Error: Can't resolve 'os' in '/Users/user/Projects/workspace/node_modules/multer/storage'

Error: ./node_modules/content-disposition/index.js
Module not found: Error: Can't resolve 'path' in '/Users/user/Projects/workspace/node_modules/content-disposition'

Error: ./node_modules/express/lib/response.js
Module not found: Error: Can't resolve 'path' in '/Users/user/Projects/workspace/node_modules/express/lib'

Error: ./node_modules/express/lib/application.js
Module not found: Error: Can't resolve 'path' in '/Users/user/Projects/workspace/node_modules/express/lib'

Error: ./node_modules/express/lib/view.js
Module not found: Error: Can't resolve 'path' in '/Users/user/Projects/workspace/node_modules/express/lib'

Error: ./node_modules/mime/mime.js
Module not found: Error: Can't resolve 'path' in '/Users/user/Projects/workspace/node_modules/mime'

Error: ./node_modules/mime-types/index.js
Module not found: Error: Can't resolve 'path' in '/Users/user/Projects/workspace/node_modules/mime-types'

Error: ./node_modules/mkdirp/index.js
Module not found: Error: Can't resolve 'path' in '/Users/user/Projects/workspace/node_modules/mkdirp'

Error: ./node_modules/multer/storage/disk.js
Module not found: Error: Can't resolve 'path' in '/Users/user/Projects/workspace/node_modules/multer/storage'

Error: ./node_modules/send/index.js
Module not found: Error: Can't resolve 'path' in '/Users/user/Projects/workspace/node_modules/send'

Error: ./node_modules/serve-static/index.js
Module not found: Error: Can't resolve 'path' in '/Users/user/Projects/workspace/node_modules/serve-static'

Error: ./node_modules/@nestjs/microservices/client/client-redis.js
Module not found: Error: Can't resolve 'redis' in '/Users/user/Projects/workspace/node_modules/@nestjs/microservices/client'

Error: ./node_modules/@nestjs/microservices/server/server-redis.js
Module not found: Error: Can't resolve 'redis' in '/Users/user/Projects/workspace/node_modules/@nestjs/microservices/server'

Error: ./node_modules/@nestjs/core/router/sse-stream.js
Module not found: Error: Can't resolve 'stream' in '/Users/user/Projects/workspace/node_modules/@nestjs/core/router'

Error: ./node_modules/busboy/lib/main.js
Module not found: Error: Can't resolve 'stream' in '/Users/user/Projects/workspace/node_modules/busboy/lib'

Error: ./node_modules/busboy/lib/types/multipart.js
Module not found: Error: Can't resolve 'stream' in '/Users/user/Projects/workspace/node_modules/busboy/lib/types'

Error: ./node_modules/destroy/index.js
Module not found: Error: Can't resolve 'stream' in '/Users/user/Projects/workspace/node_modules/destroy'

Error: ./node_modules/dicer/lib/Dicer.js
Module not found: Error: Can't resolve 'stream' in '/Users/user/Projects/workspace/node_modules/dicer/lib'

Error: ./node_modules/dicer/lib/PartStream.js
Module not found: Error: Can't resolve 'stream' in '/Users/user/Projects/workspace/node_modules/dicer/lib'

Error: ./node_modules/readable-stream/readable.js
Module not found: Error: Can't resolve 'stream' in '/Users/user/Projects/workspace/node_modules/readable-stream'

Error: ./node_modules/readable-stream/lib/_stream_readable.js
Module not found: Error: Can't resolve 'stream' in '/Users/user/Projects/workspace/node_modules/readable-stream/lib'

Error: ./node_modules/readable-stream/lib/_stream_writable.js
Module not found: Error: Can't resolve 'stream' in '/Users/user/Projects/workspace/node_modules/readable-stream/lib'

Error: ./node_modules/send/index.js
Module not found: Error: Can't resolve 'stream' in '/Users/user/Projects/workspace/node_modules/send'

Error: ./node_modules/body-parser/lib/read.js
Module not found: Error: Can't resolve 'zlib' in '/Users/user/Projects/workspace/node_modules/body-parser/lib'

前端应用程序中未使用所有这些依赖项。仅在后端应用程序中。后端应用程序构建、编译和运行都很好。那么为什么 Ivy 对此如此严格?

我完全赞成与您分享我的代码,但这不是我的问题。 那么我的问题是什么?

为什么 Ivy 抱怨不属于前端应用程序的模块?这是我需要更改的设置吗?

如果您需要更多信息来回答我的问题,请索取。

经过一天的项目审查,我是:

  • 正在从使用后端库的中间件导入 class。

  • 在前端使用后端的库

修复问题也符合最佳实践。

我把中间件中的class拆分成了两个classes:一个给前端,一个给后端。我重构了代码,这样前端就不需要后端库了。我最终只修复了两个文件。所有的错误都消失了。

因此,如果您遇到类似的情况,请仔细检查您是否在前端使用了某些后端 libraries/classes。