Repository navigation
Description
🐞 bug report
angular/*@8.1.0 (Ivy engine enabled)
Is this a regression?
It works with Ivy disabled.
Description
Ivy + Angular Universal doesn't seems to work
🔬 Minimal Reproduction
1. New project with Ivy
ng new test-angular --enableIvy
2. Add Angular Universal
ng add @nguniversal/express-engine --clientProject test-angular
3. When I do ng build I get an error
ERROR in Node does not exist: "path_to/node_modules/@nguniversal/express-engine"
Repo :
https://github.com/Palapapaa/test-app
🔥 Exception or Error
ERROR in Node does not exist: "path_to/node_modules/@nguniversal/express-engine"
🌍 Your Environment
Angular Version:
Angular CLI: 8.1.0
Node: 10.15.3
OS: win32 x64
Angular: 8.1.0
... animations, cli, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... platform-server, router
Package Version
--------------------------------------------------------------------
@angular-devkit/architect 0.801.0
@angular-devkit/build-angular 0.801.0
@angular-devkit/build-optimizer 0.801.0
@angular-devkit/build-webpack 0.801.0
@angular-devkit/core 8.1.0
@angular-devkit/schematics 8.1.0
@ngtools/webpack 8.1.0
@nguniversal/express-engine 8.1.1
@nguniversal/module-map-ngfactory-loader 8.1.1
@schematics/angular 8.1.0
@schematics/update 0.801.0
rxjs 6.4.0
typescript 3.4.5
webpack 4.35.2
Anything else relevant?
I only have this error when I use Angular in Ivy mode (when I set enableIvy to false in my tsconfig.app.json I can successfully build my app).
If I delete these lines in main.server.ts file (a file generated in step 2)
export { ngExpressEngine } from "@nguniversal/express-engine";
export { provideModuleMap } from "@nguniversal/module-map-ngfactory-loader";
The commands ng build, ng serve works but I still can use SSR (npm run serve:ssr fails with TypeError: provideModuleMap is not a function because of the line I've deleted I guess ...)
Thank you =)
Activity
guillaume-moreau commentedon Jul 17, 2019
Hi guys !
Any news ? :)
Is this an Ivy bug ?
vikerman commentedon Jul 18, 2019
Looks like an ngcc issue. Will follow up. Thanks
petebacondarwin commentedon Jul 18, 2019
Running
npm run ivy-ngcc -l debuggives us the answer:ngcc doesn’t know about
fs(it doesn’t exist in thenode_modulesfolder 🙂) so it thinks that@nguniversal/express-engineis not valid and doesn’t try to compile it.This is a very unusual case as most Angular packages never run on the server so it would not make sense to import node.js built-in packages.
I think the fix is that we need to have an
ignorelist of modules that we assume are ignorable.omahjoub commentedon Jul 23, 2019
Hi all, same problem here, is there any planned fix to this?
petebacondarwin commentedon Jul 23, 2019
No fix created yet... It is in the pipeline.
JoostK commentedon Jul 26, 2019
We can leverage
require('module').builtinModulesto know which modules to ignore :-)fix(ivy): ngcc - do not consider builtin NodeJS modules as missing
fix(ivy): ngcc - do not consider builtin NodeJS modules as missing (a…
akshaypatidar455 commentedon Sep 14, 2019
please off the angular IVY form tsconfig.spec.json
"angularCompilerOptions": {
"enableIvy": false
}
and also form
tsconfig.app.json
"angularCompilerOptions": {
"enableIvy": false
}
angular-automatic-lock-bot commentedon Oct 15, 2019
This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.
Read more about our automatic conversation locking policy.
This action has been performed automatically by a bot.