angular-cli: Universal --bundle-dependencies=all works with --aot but fails with --prod
Versions
Angular CLI: 1.6.0
Node: 8.9.1
OS: win32 x64
Angular: 5.1.0
... animations, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, platform-server, router
@angular/cdk: 5.0.1
@angular/cli: 1.6.0
@angular/flex-layout: 2.0.0-beta.11-b01c2d7
@angular/material: 5.0.1
@angular-devkit/build-optimizer: 0.0.35
@angular-devkit/core: 0.0.22
@angular-devkit/schematics: 0.0.40
@ngtools/json-schema: 1.1.0
@ngtools/webpack: 1.9.0
@schematics/angular: 0.1.10
@schematics/schematics: 0.0.10
typescript: 2.4.2
webpack: 3.10.0
Repro steps
When using below command it works perfectly.
ng build -- --app=ssr --output-hashing=media --aot --bundle-dependencies=all
But when we run below command:
ng build -- --app=ssr --output-hashing=media --prod --bundle-dependencies=all
It throws below warnings:
WARNING in ./node_modules/@angular/core/bundles/core.umd.js
6579:23-44 Critical dependency: the request of a dependency is an expression
at ImportLazyContextDependency.getWarnings (D:\MyProject\ClientApp\node_modules\webpack\lib\dependencies\ContextDependency.js:39:18)
at Compilation.reportDependencyErrorsAndWarnings (D:\MyProject\ClientApp\node_modules\webpack\lib\Compilation.js:703:24)
at Compilation.finish (D:\MyProject\ClientApp\node_modules\webpack\lib\Compilation.js:561:9)
at applyPluginsParallel.err (D:\MyProject\ClientApp\node_modules\webpack\lib\Compiler.js:502:17)
at D:\MyProject\ClientApp\node_modules\tapable\lib\Tapable.js:289:11
at _addModuleChain (D:\MyProject\ClientApp\node_modules\webpack\lib\Compilation.js:507:11)
at processModuleDependencies.err (D:\MyProject\ClientApp\node_modules\webpack\lib\Compilation.js:477:14)
at _combinedTickCallback (internal/process/next_tick.js:131:7)
at process._tickCallback (internal/process/next_tick.js:180:9)
@ ./node_modules/@angular/core/bundles/core.umd.js
@ ./src/main.server.ts
@ multi ./src/main.server.ts
WARNING in ./node_modules/@angular/core/bundles/core.umd.js
6599:23-110 Critical dependency: the request of a dependency is an expression
at ImportLazyContextDependency.getWarnings (D:\MyProject\ClientApp\node_modules\webpack\lib\dependencies\ContextDependency.js:39:18)
at Compilation.reportDependencyErrorsAndWarnings (D:\MyProject\ClientApp\node_modules\webpack\lib\Compilation.js:703:24)
at Compilation.finish (D:\MyProject\ClientApp\node_modules\webpack\lib\Compilation.js:561:9)
at applyPluginsParallel.err (D:\MyProject\ClientApp\node_modules\webpack\lib\Compiler.js:502:17)
at D:\MyProject\ClientApp\node_modules\tapable\lib\Tapable.js:289:11
at _addModuleChain (D:\MyProject\ClientApp\node_modules\webpack\lib\Compilation.js:507:11)
at processModuleDependencies.err (D:\MyProject\ClientApp\node_modules\webpack\lib\Compilation.js:477:14)
at _combinedTickCallback (internal/process/next_tick.js:131:7)
at process._tickCallback (internal/process/next_tick.js:180:9)
@ ./node_modules/@angular/core/bundles/core.umd.js
@ ./src/main.server.ts
@ multi ./src/main.server.ts
And when we run the app it shows below error in log:
StaticInjectorError[InjectionToken DocumentToken]:
StaticInjectorError[InjectionToken DocumentToken]:
Right-hand side of 'instanceof' is not an object
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Comments: 36 (4 by maintainers)
You’re logging a bug because you don’t want to type your password?
If there’s a valid workaround, let’s move on & let them work on more important stuff like Angular v7 & ivy.
I’ll drop out of this conversation now. Not trying to start a flaming war & I don’t have anything else useful to contribute. But, the issue feels unnecessary to me.