New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Uncaught Error: Cannot find module "." #4921
Comments
Check build for errors. |
Can you provide a minimal sample repo that shows that issue? |
Happened to me as well, turns out it was because i was using require with an expression instead of a value:
Since module resolution is static - variables are not allowed, so you could just go with
|
@danielzlotnik Same thing here. |
@danielzlotnik +1 |
same problem here :( |
it helped me: require(`${path_to_file}`); and if you need more variable in your dynamic path try split require: function getIcon(name) {
const [category, filename] = name.split(":");
if (filename) {
return require(`one_directory/icons/${category}/${filename}.svg`);
} else {
return require(`two_directory/icons/${name}.svg`);
}
} |
I'm having this issue, but with import() :( |
|
@rawbin- is |
I have the same issue using import in ionic. Any suggestions? |
I'm getting the same error with Ionic 3 also... @jayzyaj did you get to solve it? |
In my case I've removed last pages I've generated and rolled back to previous version.. It worked. Something was messed up when generated the last page.. |
@Kaidanov that worked for me too last time...only this time the problem didn't appear after generating a page, but renaming it... |
Rollback.. you at least have local git.. just set copy of what you have right now aside.. then rollback until it works.. Then compare folders and merge what is needed and run serve after each merge just to be sure it still works. Maybe you forgot to update the app.module with the new name? Search in the whole project for the old name of the component.. |
I think i found a solution, at least for Ionic. I have no idea what's causing this, but it appears that i get the error when some imports add "/umd" at the end. I had two projects with the same problem, and i fixed both by doing this... Are you all using VS Code? |
This is exactly what happened to me, using VS Code +1 @killian2301 Not sure why this happening all of the sudden. Never had this issue until today. |
Thanks a lot @killian2301 ! I'm also using Ionic and got the same problem. Your tip helped me. |
Yep, Vs Code added |
Ran into the same issue (not using Ionic), unable to use template literals within the require after upgrading to Babel 7. We are currently using webpack 2.x and will be upgrading to 4 soon - I believe this has to do with new babel + older webpack not being friendly in my scenario. Not Working config = require(`../inc/${process.env.targetNetwork}.config.json`); Working config = require('../inc/' + process.env.targetNetwork + '.config.json'); This is the temporary fix I've applied that works for me. Hope this helps someone in the future 👍 |
@killian2301 You're the man!! Wish I would've found your answer hours ago! |
i'm glad to hear that! :) |
Sounds like it's coming from this: microsoft/TypeScript#25204 However, when I did replace all on my project to remove all /umd instances, my UI is now borked. Completely unstyled. Will report back if I can figure out what the heck I did. |
@rihlsul Just recompile / restart the app and the styles comes back. I had the same problem. After removing all umd from imports, the html of my app (ionic) was naked. But a rebuild fixed this issue. |
Confirmed that did resolve it. Bizarro. Thanks! |
@killian2301 thanks I did what you wrote with vs and it worked. |
Happened to me. I copied a page for a slightly different use case and accidentally set VSCode to update dependencies. The shitshow that ensued was 149 changed files - a lot of which had /umd tacked on to some imports. Checking my settings I noticed :
And removed it. Problem solved. |
@killian2301 it works for me. After hours looking for the problem, I solved it remoming all "/umd" statements from all imports that was added when I created a new Page. |
Have the same issue (ionic 3). Found all the /umd/s and removed them. Restarted with ionic serve, even tried an ionic build but am still getting the same issue. Anyone help?? UPDATE: I went back into appmodule.ts after many rebuilds and reloads and i modified it again (ie removed a space) and then saved it and it worked. No idea why |
hey @killian2301 what is this /umd |
@kuldeep-kumar Sorry, i have no idea what it is. I just know it's vscode who is messing things up... |
Okay!Thanks👍 |
Decreasing the version to ~2.6.2 fixed it. |
|
In addition to the I think it was all due to renaming in VSCode, so try to avoid that if you can. |
Me to !! Thank's really 😂 |
This can seemingly cause problems in webpack (see webpack/webpack#4921).
+1 that worked for me |
don't use . |
sometimes in the import ionic-angular is changed as 'ionic-angular/umd'. just remove /umd it should be ok |
Thanks @pjc2007 you saved my day ... |
I can’t downgrade typescript;
And, I find "umd" in all solutions but no results. Any solution? |
Are you using Ionic 3? if so, you have to downgrade if you want to get rid of the error. Try to downgrade to 2.6.2 and change your package json to version 6 of rxjs. In package.json: This: Not this: |
Do you want to request a feature or report a bug? bug
What is the current behavior?
Below exception:
If the current behavior is a bug, please provide the steps to reproduce.
Configuration files are uploaded on Github gist https://gist.github.com/shafaqkazmi/abbf5b07a70e6d23463d2de7d42f2a53
What is the expected behavior?
Application should load all desired modules
Please mention other relevant information such as the browser version, Node.js version, webpack version and Operating System.
Version details:
The text was updated successfully, but these errors were encountered: