-
Notifications
You must be signed in to change notification settings - Fork 11.9k
SSR builder and externals dependencies (Angular 9) #16348
Description
Bug Report
In relation to the conversation with @manfredsteyer.
What is the expected behavior?
In some specific scenarios, I would like to bundle dependencies and minify the code of my Angular application, but at the same time leave my server-side code untouched (no dependencies bundled, no minification/obfuscation). This is important because:
- sometimes you may not want to bundle all server dependencies (especially when you're building a full-stack app). For instance, you won’t be able to bundle
pg(if you use postgres) as well as internal deps ofmongoose(orbcrypt) because they use a native node.js binaries (C++ code) - sometimes you may not want to obfuscate class names, properties names, function names etc because there are important for libraries such as Typeorm (to automatically create columns with proper names in a database) or e.g. NestJS. Having full control over what can be optimized for server-side is quite important here
What is the current behavior?
When I try to set bundleDependencies to none under server configuration in angular.json, the application will stop working:
Both serve:ssr and serve:ssr:dev won't work.
Also, I'm not entirely sure how I can determine the behavior of webpack for the server part now. Previously, we had webpack.server.config in which we could simply use plugins like nodeExternals or set optimization to false (to avoid code minification). This is worth adding to the docs (how to accomplish this now with a new setup).
What modules are related to this issue?
- [ ] aspnetcore-engine
- [ ] common
- [ ] express-engine
- [ ] hapi-engine
- [ ] module-map-ngfactory-loader
Minimal reproduction with instructions:
No reproduction needed - new Angular app with ng add @nguniversal/express-engine@next (or any other engine)
What is the use-case or motivation for changing an existing behavior?
Mainly full-stack applications, compatibility with other Node.js platforms
Environment:
@nguniversal versions
- aspnetcore-engine:
- common:
- express-engine: 9.0.0-next.7
- hapi-engine:
- module-map-ngfactory-loader:
Angular CLI: 9.0.0-rc.4
Node: 12.13.0
OS: darwin x64
Angular: 9.0.0-rc.4
