hello are there some re…
hello, are there some resources to help me troubleshoot a @nrwl/node build? It is currently not bundling any dependencies, even though it looks like that is supposed to be the default. Here is the relevant part of my workspace.json
"dashboard-api": {
"root": "apps/dashboard-api",
"sourceRoot": "apps/dashboard-api/src",
"projectType": "application",
"prefix": "dashboard-api",
"schematics": {},
"architect": {
"build": {
"builder": "@nrwl/node:build",
"options": {
"outputPath": "dist/apps/dashboard-api",
"main": "apps/dashboard-api/src/main.ts",
"tsConfig": "apps/dashboard-api/tsconfig.app.json",
"assets": [
"apps/dashboard-api/src/assets",
"apps/dashboard-api/src/config"
]
},
"configurations": {
"production": {
"optimization": true,
"extractLicenses": true,
"inspect": false,
"externalDependencies": "all",
"fileReplacements": [
{
"replace": "apps/dashboard-api/src/environments/environment.ts",
"with": "apps/dashboard-api/src/environments/environment.prod.ts"
}
]
}
}
},
Do I need to explicitly configure a webpack plugin somewhere?
Responses:
as far as I understand, a node build will never bundle (external) dependencies like 3rd party npm packages. they have to be installed alongside the app
the bundler will only transpile your own typescript code into a js bundle
hmm. Is there a convenient way to do that? The build doesn’t make a package.json or anything
Also here (https://nx.dev/angular/plugins/node/builders/build) it says that “externalDependencies” defaults to “all”
well, then it looks like you have to set it to “none”
> Dependencies to keep external to the bundle
so you want to keep none external
ah yeah, I definitely misread that. 1 sec
progress! now I get a bunch of errors starting with:
WARNING in ./node_modules/config/parser.js 55:7-14
Critical dependency: require function is used in a way in which dependencies cannot be statically extracted
and then a bunch of “can’t resolve” errors
sorry, thats all I can help you with. Judging by that error, the dependencies cannot be exactly determined
no worries. Thanks for your help
maybe you need to use the third option, manually enter all necessary dependencies in an array
maybe it is only a handful