Lazy loading module not found error in angular 8 - javascript

I have copied my existing Angular Project src and package.json file and created new angular project and replaced with my backup src and package.json files.
After that i run npm install. when i try to run the project by ng serve command i am getting this error.
ERROR in ./$$_lazy_route_resource lazy namespace object
Module not found: Error: Can't resolve '/Users/Desktop/Angular/matrix/src/app/ads1/ads1.module.ngfactory.js' in '/Users/Desktop/Angular/matrix/$$_lazy_route_resource'
ERROR in ./$$_lazy_route_resource lazy namespace object
Module not found: Error: Can't resolve '/Users/Desktop/Angular/matrix/src/app/ads2/ads2.module.ngfactory.js' in '/Users/Desktop/Angular/matrix/$$_lazy_route_resource'
ERROR in ./$$_lazy_route_resource lazy namespace object
Module not found: Error: Can't resolve '/Users/Desktop/Angular/matrix/src/app/ads3/ads3.module.ngfactory.js' in '/Users/Desktop/Angular/matrix/$$_lazy_route_resource'
ERROR in ./$$_lazy_route_resource lazy namespace object
Module not found: Error: Can't resolve '/Users/Desktop/Angular/matrix/src/app/banner/banner.module.ngfactory.js' in '/Users/Desktop/A

Yeah found the issues its an angular version mismatch.

You need to add paths to your lazy loaded modules to "files" in tsconig.aot.json:
...
"files" [
...
"./ads1/ads1.module.ts",
etc
...
],

Related

How to use module `module` in a vue project?

ERROR Failed to compile with 6 errors 16:20:36
This dependency was not found:
* module in ./node_modules/#eslint/eslintrc/lib/shared/relative-module-resolver.js, ./node_modules/eslint-plugin-vue/lib/rules/experimental-script-setup-vars.js and 4 others
I want to use eslint and eslint-plugin-vue directly in my vue project, but I got the above error after run serve.
How to polyfill module or how to resolve it? Thank you all.
Project:
use vue.config.js
We can resolve the problem by this way:
https://github.com/ota-meshi/eslint-plugin-vue-demo
The link page refer us a demo to use eslint and eslint-plugin-vue in browser.
Configs in vue.config.js of project can resolve the above question:
resolve: {
alias: {
// resolve `module` not found
module: path.resolve("./shim/module.js"),
globby: path.resolve("./shim/empty"),
eslint$: path.resolve("./shim/eslint/index.js"),
esquery: path.resolve("./node_modules/esquery/dist/esquery.min.js"),
"#eslint/eslintrc/universal": path.resolve(
"./node_modules/#eslint/eslintrc/dist/eslintrc-universal.cjs",
),
}
},
alias links to this directory:
https://github.com/ota-meshi/eslint-plugin-vue-demo/tree/main/shim
Other alias will resolve faults after resolve module not found happen.

How to fix Module not found: Error: Can't resolve 'datatables.net' on Webpack

I want to bundle the vendor dependencies of my website using webpack, but I'm having a problem with jquery dependant dependencies. The only thing I need is to bundle the files into one, and import it on my index.html. It seems to me that webpack is trying to import things from the library, which is not necessary, the final bundle is the goal.
ERROR in ./plataforma/assets/js/dataTables.checkboxes.min.js
Module not found: Error: Can't resolve 'datatables.net' in '/Users/julianograms/Documents/Mapi/mapi-front/plataforma/assets/js'
# ./plataforma/assets/js/dataTables.checkboxes.min.js 5:62-145
# ./plataforma/src/vendor.js

Create Angular 1 Browserify module for use in multiple applications

Im trying to create a reusable package of both angular and nodejs code into a single repo, and then use that via bower or npm internally. Taking this simple example below, I cannot get it to work in an existing angular app.
getting the typical angular error below because the module cannot be found.
Error: [$injector:modulerr] Failed to instantiate module toolkit due to:
Error: [$injector:nomod] Module 'toolkit' is not available!
Here is my test.module.js file.
var testService = require('./test.service.js');
angular.module('noble.test', [
]).service('TestService', testService);
here is test.service.js
module.exports = function($http){
this.exposedFn = exposedFn;
////////////////
function exposedFn() {
alert('Hello!');
}
}
Here is my index.js
require('./test/test.module.js')
angular.module('noble.toolkit', [
'noble.test'
]);
directory structure:
index.js
test
test.service.js
test.module.js
browserify command
browserify --entry index.js -o dist.js

How do I resolve modules that get processed by exports-loader in webpack?

I'm using webpack 2.1.0-beta.20 and am getting a Module not found: Error: Can't resolve error when trying to build.
I have a file EmsWorkerProxy.js that does not export a module, so I'm using exports-loader so that I can require() it in my script.
On top of that, I also want to turn that into a web worker, so I'm chaining worker-loader to that.
I'd love to not use relative or absolute paths. The scripts are in a vendor directory, so I'm trying to add this to my webpack.conf.js:
resolve: {
modules: [
'node_modules',
'src',
'vendor'
]
},
Unfortunately, it seems like webpack still can't resolve anything.
The line in my app that does
const EmsWorkerProxy = require('worker!exports?EmsWorkerProxy!EmsWorkerProxy'); causes:
Module not found: Error: Can't resolve 'EmsWorkerProxy'
Am I not using webpack correctly?

Error while adding dependency for angular-materialize

I want to use materialize for my angular project from https://github.com/krescruz/angular-materialize but I get the error
angular.js:68 Uncaught Error: [$injector:modulerr] Failed to
instantiate module F1FeederApp due to: Error: [$injector:modulerr]
Failed to instantiate module ui.materialize due to: Error:
[$injector:nomod] Module 'ui.materialize' is not available! You either
misspelled the module name or forgot to load it. If registering a
module ensure that you specify the dependencies as the second
argument.
In my app.js:
angular.module('F1FeederApp', [
'ui.materialize',
'F1FeederApp.services',
'F1FeederApp.controllers',
'ngRoute'
]).
What am I doing wrong? According to the link above these declarations should have been enough..
Try running this in root of your project if you are using bower.
bower install angular-materialize --save
and add the source file angular-materialize/src/angular-materialize.js into your index.html
OR
If you are not using bower or node download this file in your project and add it in your index.html
Hope this helps

Categories

Resources