I'm using angular compiler:
const AngularCompilerPlugin = require('@ngtools/webpack').AngularCompilerPlugin;
With these compiler options:
"angularCompilerOptions": {
"genDir": "./build/compiled",
"outDir": "./build/compiled",
"skipMetadataEmit": true,
"debug": true},
Relevant part of my package.json is:
"@ngtools/webpack": "^6.0.0",
"@angular/router": "^5.2.0",
"webpack": "4.8.3",
"webpack-cli": "2.1.4",
And my angularCompilerPlugin config is:
new AngularCompilerPlugin({
tsConfigPath: 'path-to-tsconfig.webpack.json',
entryModule: 'path-to-app.module#AppModule',
sourceMap: true
}),
With these configurations, I'm getting:
ERROR in ./$$_lazy_route_resource lazy namespace object
Module not found: Error: Can't resolve 'path-/alerts/module.ngfactory.js' in 'path-to-app-folder/$$_lazy_route_resource'
@ ./$$_lazy_route_resource lazy namespace object
@ ./node_modules/@angular/core/esm5/core.js
@ multi core-js/shim classlist.js reflect-metadata zone.js/dist/zone jquery/dist/jquery rxjs/Rx lodash jquery.panzoom moment moment-timezone @angular/common @angular/core @angular/http @angular/router @angular/forms semantic
Please any direction or help.
Provides support for lazy initialization. The type of object that is being lazily initialized. System. Lazy<T,TMetadata> The following example demonstrates the use of the Lazy<T> class to provide lazy initialization with access from multiple threads. The example uses the Lazy<T> (Func<T>) constructor.
We don't not need to inject lazy module in App.module.ts. As we importing "RouterModule.forRoot (ROUTES, { useHash: false , scrollPositionRestoration: 'enabled'})" Sorry, something went wrong. This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.
This enables the Lazy<T> object to create a copy of the lazily initialized object on each of several threads if the threads call the Value property simultaneously. The Lazy<T> object ensures that all threads use the same instance of the lazily initialized object and discards the instances that are not used.
Lazy loading is an approach to limit the modules that are loaded to the ones that the user currently needs. This can improve your application’s performance and reduce the initial bundle size. By default, Angular uses eager loading to load modules. This means that all the modules must be loaded before the application can be run.
I was able to resolve this error by adding the Lazy Module .ts
paths to my ts.config-aot.json
in the files
section:
{
"compilerOptions": {
"target": "es5", //most browsers currently understand this version of Javascript
"experimentalDecorators": true, //Angular2 uses Component,Injectable etc
"emitDecoratorMetadata": true, //Required for Angular2 to use the metadata in our components
"types": [
"node",
"jasmine"
],
"lib": [
"es2015",
"es2015.iterable",
"dom"
]
},
"exclude": [
"node_modules"
],
"files": [
"src/app/app.module.ts",
"src/main.ts",
"src/app.d.ts",
"src/app/sandbox/sandbox.module.ts",
"src/app/supplier-xchange/supplier-xchange.module.ts",
"src/app/company-profile/company-profile.module.ts",
"src/app/bom/bom.module.ts",
"src/app/custom-price-column/custom-price-column.module.ts",
"src/app/neca/neca.module.ts"
]
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With