Мне нужно собрать все мое приложение nest js в один файл, и оно должно содержать все необходимые зависимости. Например, я создал простое гнездовое приложение с
nest new testProject
и добавил файл webpack.package. js file:
module.exports = {
entry: ['./dist/main.js'],
target: 'node',
output: {
path: `${process.cwd()}/bin`,
filename: 'getState.js',
libraryTarget: 'umd'
}
};
После того, как я перенесу ts ty es5 с помощью npm build
. И запустите npx webpack
, чтобы связать мой js. Но есть ошибки с модулями узла, я не понимаю, почему webpack не может их найти
Hash: 281791709eed73aedd9f
Version: webpack 4.41.5
Time: 1464ms
Built at: 2020-01-29 17:45:17
1 asset
Entrypoint main = getState.js
[2] ./node_modules/rxjs/_esm5/internal/Observable.js + 1 modules 4.75 KiB {0} [built]
| 2 modules
[63] external "http" 42 bytes {0} [built]
[93] ./node_modules/rxjs/_esm5/internal/scheduler/asap.js + 3 modules 3.7 KiB {0} [built]
| 4 modules
[97] external "crypto" 42 bytes {0} [built]
[142] ./node_modules/rxjs/_esm5/index.js + 19 modules 35.8 KiB {0} [built]
| 20 modules
[151] ./node_modules/rxjs/_esm5/internal/scheduled/scheduled.js + 5 modules 5.14 KiB {0} [built]
| 6 modules
[171] external "os" 42 bytes {0} [built]
[182] ./node_modules/rxjs/_esm5/operators/index.js + 97 modules 176 KiB {0} [built]
| 98 modules
[251] ./node_modules/@nestjs/core/helpers sync 160 bytes {0} [optional] [built]
[293] ./dist/app.service.js 926 bytes {0} [built]
[294] multi ./dist/main.js 28 bytes {0} [built]
[295] ./dist/main.js 340 bytes {0} [built]
[423] ./node_modules/@nestjs/common/utils sync 160 bytes {0} [optional] [built]
[658] ./dist/app.module.js 1.07 KiB {0} [built]
[659] ./dist/app.controller.js 1.49 KiB {0} [built]
+ 645 hidden modules
ERROR in ./node_modules/@nestjs/core/nest-application.js
Module not found: Error: Can't resolve '@nestjs/microservices' in '/home/aleksandr/IdeaProjects/test-project/node_modules/@nestjs/core'
@ ./node_modules/@nestjs/core/nest-application.js 109:115-147
@ ./node_modules/@nestjs/core/index.js
@ ./dist/main.js
@ multi ./dist/main.js