-
-
Notifications
You must be signed in to change notification settings - Fork 5.8k
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
The requested module does not provide an export named #11783
Comments
Hi, I think we have the same problem. Unfortunately no one has replied yet. I noticed that the build sometimes goes through and sometimes it doesn't. Esbuild generates files of various sizes. Below are my observations. I have a very big problem because for a few days now I can't build the project properly because it randomly stops working. |
This comment was marked as duplicate.
This comment was marked as duplicate.
Thanks for your input everyone, @sapphi-red if the repo is working fine for you, can you please share your system info? |
Yeah, it worked fine for me. This is my system info.
Posting screen recordings and logs with |
@sapphi-red Thanks for your response! I tried to update my node version to 18.13.10, also tested on Edge, but same issue. I tried to run But it just hangs forever on the last line:
Should I post the whole log? Or is it stored in a file? Thanks a lot for your help |
@omerfaran A whole log in |
@sapphi-red Sorry for the silly question but should I run this command in the "main" app package, or at the root level? When running at the root, it complains that I didn't create a vite.config file. Inside "main" it now works without issues:
|
@sapphi-red Yes it happens only with the combination of Nx + Vite, with Nx plus Webpack it's all working fine |
If it only happens with Nx, I guess this is related to Nx. |
For anyone stumbling into this issue, try clearing out |
@sapphi-red I found out that it actually happens not just with Nx, but by creating a new Vite app, I will still get this error from time to time. Obviously it means it's something with my environment, node version, maybe. Even though I tried jumping between versions, also tried on Edge, not just Chrome. I'm out of ideas @joeyfigaro for me at least that didn't help, also just creating a new Vite app creates this error.... |
This comment was marked as duplicate.
This comment was marked as duplicate.
@omerfaran Would you upload that new project including node_modules to GitHub? Maybe I can find something. |
In my case, after config these in tsconfig.json in the shared-lib
It works |
Hello @omerfaran. Please provide a minimal reproduction using a GitHub repository or StackBlitz. Issues marked with |
I've had a similar issue and stumbled upon this one while searching for a solution. Later on I managed to fix my issue by changing the import style. In the case of the issue OP posted, I suppose the fix for the problematic file would be changing
into
|
I have encounter this problem too when |
It seems like this issue is happening only on windows machines. |
@ar7casper Not really, I am running into this problem on my Ubuntu VM too. Nx + Vite, just a random typescript interface that cannot be exported/ imported whatsoever, while the other enums and types from the same file have no problems at all. Same behavior as @omerfaran - nothing renders, no error during build time, The problem goes away when I remove the code that uses the imported interface and everything goes back to normal. I am importing all my types and stuff from my Nodejs backend project to my React frontend project, but literally everything else works except this specific export. Update: I am export an enum and an interface from the same file, importing them in my React project, and when I import both it doesnt work, if I remove only the enum it works with the interface alone being in used. But I am not sure if the problem is with typescript enum because the browser says that the missing export is of this interface that works instead of the enum that doesnt. same problem mentioned here: nrwl/nx#13704 I am not sure if everyone is having this problem due to typescript enums but I am pretty sure mine is, I solved my problem by moving my enums to the types/index.ts instead of having them in seperate files doing barrel export. |
Describe the bug
Sometimes, after editing in my IDE and saving, the page reloads and I receive an error along those lines:
Uncaught SyntaxError: The requested module '/src/app/App.tsx?t=1674391177584' does not provide an export named 'default' (at main.tsx:4:8)
What comes after 'named' may be different. When this error appears, nothing renders on the screen. In the terminal no error appears.
To "fix" this, what I have to do is undo in my IDE, redo, and save again (basically change nothing), and then the error will go away. If instead of this I just try to refresh the page the error will still be there.
In addition, I see the following error at all times (on each reload), even when everything seems to work fine:
Uncaught (in promise) TypeError: Cannot convert undefined or null to object
What I did notice is that the strange bug happens once I import from another lib in my app. Therefore I created a very simple reproduction repo, where in my App.tsx I import a React component from another lib and render it on the screen.
Reproduction
https://github.com/omerfaran/vite-test
Steps to reproduce
Please download the repo, run pnpm install, and then 'nx serve main'.
Everything should work, but if you for example comment out
<Testlib1 />
(which is an imported component), and then comment it in, or out again (it's pretty random), you should get the unexpected error, and the page won't render.System Info
Used Package Manager
pnpm
Logs
No response
Validations
The text was updated successfully, but these errors were encountered: