ultimatecourses / angular-lazy-load-demo Goto Github PK
View Code? Open in Web Editor NEWLazy loading: code-splitting with @NgModules demo
Home Page: https://ultimatecourses.com/blog/lazy-loading-angular-code-splitting-webpack
Lazy loading: code-splitting with @NgModules demo
Home Page: https://ultimatecourses.com/blog/lazy-loading-angular-code-splitting-webpack
Hi Todd,
i was trying out your demo on MacOS and getting below build error with webpack compilation. have you encountered this ? we are trying to use same approach and we are getting hit with same error on our application.
`
ERROR in ./src/main.ts
Module not found: Error: Can't resolve './../ngfactory/src/app/app.module.ngfactory' in '/Users/ac64500/stash/aot-lazy/angular-lazy-load-demo/src'
@ ./src/main.ts 3:0-81
@ multi zone.js/dist/zone ./src/main.ts
ERROR in ./ngfactory lazy
Module not found: Error: Can't resolve '/Users/ac64500/stash/aot-lazy/angular-lazy-load-demo/ngfactory/src/dashboard/dashboard.module.ngfactory.ts' in '/Users/ac64500/stash/aot-lazy/angular-lazy-load-demo/ngfactory'
@ ./ngfactory lazy
@ ./node_modules/@angular/core/@angular/core.es5.js
@ ./src/main.ts
@ multi zone.js/dist/zone ./src/main.ts
ERROR in ./ngfactory lazy
Module not found: Error: Can't resolve '/Users/ac64500/stash/aot-lazy/angular-lazy-load-demo/ngfactory/src/settings/settings.module.ngfactory.ts' in '/Users/ac64500/stash/aot-lazy/angular-lazy-load-demo/ngfactory'
@ ./ngfactory lazy
@ ./node_modules/@angular/core/@angular/core.es5.js
@ ./src/main.ts
@ multi zone.js/dist/zone ./src/main.ts
ERROR in ./ngfactory lazy
Module not found: Error: Can't resolve '/Users/ac64500/stash/aot-lazy/angular-lazy-load-demo/ngfactory/src/reports/reports.module.ngfactory.ts' in '/Users/ac64500/stash/aot-lazy/angular-lazy-load-demo/ngfactory'
@ ./ngfactory lazy
@ ./node_modules/@angular/core/@angular/core.es5.js
@ ./src/main.ts
@ multi zone.js/dist/zone ./src/main.ts
`
ngc will not compile those files. I got error for path import in css files. If import is present it'll fail. What's the solution?
Hi Todd,
Sorry to bother you and thanks for all the great content. I cloned this repo and all works fine if I run a build:dev, however if I run a production build I get issues with the generated aot code not being found
D:\devroot\Angular-LazyLoad-Starter\angular-lazy-load-demo-master>npm run build
> [email protected] build D:\devroot\Angular-LazyLoad-Starter\angular-lazy-load-demo-master
> cross-env NODE_ENV=production webpack -p
Hash: 45fc0fa9071a547f683a
Version: webpack 3.0.0
Time: 10134ms
Asset Size Chunks Chunk Names
app.js 513 bytes 0 [emitted] app
vendor.js 253 kB 1 [emitted] [big] vendor
app.js.map 3.33 kB 0 [emitted] app
vendor.js.map 2.44 MB 1 [emitted] vendor
[3] (webpack)/buildin/global.js 509 bytes {1} [built]
[15] ./ngfactory lazy 160 bytes {0} [built]
[16] multi zone.js/dist/zone ./src/main.ts 40 bytes {0} [built]
[18] ./src/main.ts 389 bytes {0} [built]
+ 40 hidden modules
ERROR in ./src/main.ts
Module not found: Error: Can't resolve './../ngfactory/src/app/app.module.ngfactory' in 'D:\devroot\Angular-LazyLoad-Starter\angular-lazy-load-demo-master\src'
@ ./src/main.ts 3:0-81
@ multi zone.js/dist/zone ./src/main.ts
ERROR in ./ngfactory lazy
Module not found: Error: Can't resolve 'D:\devroot\Angular-LazyLoad-Starter\angular-lazy-load-demo-master\ngfactory\src\dashboard\dashboard.module.ngfactory.ts' in 'D:\devroot\Angular-LazyLoad-Starter\angular-lazy-load-demo-master\ngfactory'
@ ./ngfactory lazy
@ ./node_modules/@angular/core/@angular/core.es5.js
@ ./src/main.ts
@ multi zone.js/dist/zone ./src/main.ts
ERROR in ./ngfactory lazy
Module not found: Error: Can't resolve 'D:\devroot\Angular-LazyLoad-Starter\angular-lazy-load-demo-master\ngfactory\src\settings\settings.module.ngfactory.ts' in 'D:\devroot\Angular-LazyLoad-Starter\angular-lazy-load-demo-master\ngfactory'
@ ./ngfactory lazy
@ ./node_modules/@angular/core/@angular/core.es5.js
@ ./src/main.ts
@ multi zone.js/dist/zone ./src/main.ts
ERROR in ./ngfactory lazy
Module not found: Error: Can't resolve 'D:\devroot\Angular-LazyLoad-Starter\angular-lazy-load-demo-master\ngfactory\src\reports\reports.module.ngfactory.ts' in 'D:\devroot\Angular-LazyLoad-Starter\angular-lazy-load-demo-master\ngfactory'
@ ./ngfactory lazy
@ ./node_modules/@angular/core/@angular/core.es5.js
@ ./src/main.ts
@ multi zone.js/dist/zone ./src/main.ts
npm ERR! Windows_NT 10.0.15063
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "run" "build"
npm ERR! node v6.11.0
npm ERR! npm v3.10.10
npm ERR! code ELIFECYCLE
npm ERR! [email protected] build: `cross-env NODE_ENV=production webpack -p`
npm ERR! Exit status 2
npm ERR!
npm ERR! Failed at the [email protected] build script 'cross-env NODE_ENV=production webpack -p'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the lazy-load-demo package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! cross-env NODE_ENV=production webpack -p
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs lazy-load-demo
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls lazy-load-demo
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! D:\devroot\Angular-LazyLoad-Starter\angular-lazy-load-demo-master\npm-debug.log
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.