-
Notifications
You must be signed in to change notification settings - Fork 24
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Unable to import vite module #1
Comments
Hi @Vanderscycle and @dikbek. |
Hi @UstymUkhman Thanks for your quick response! This is from the package.json:
I'm running NPM version 7.23.0, node version v14.17.3. I had the same problem trying to add vite-plugin-string to vite.config.js so I'm sure I've made a mistake somewhere. I'm relatively new to this so I could be overlooking something fundamental. @Vanderscycle is doing his best to help me out with it. Much appreciated! |
Hi @dikbek. Thanks for the info! Honestly, I suspect the error might be caused by some vite chunks haven't compiled correctly (see Vanderscycle's stack trace above). I would suggest you to remove the Then try to re-install all dependencies and print the Feel free to come back here any time. ...And thanks a lot for your star on this project. :) |
Hi @UstymUkhman Thanks for your suggestions. I implemented all of them but sadly I'm still getting the same error when I add the plugin on vite.config.js. And those chunk errors as well. I'm getting the exact same error when I try with vite-plugin-string. Can't understand why it insists they are not functions. I'll keep trying to figure it out so long. I'll let you know if I solve it, otherwise any help when you get back would be greatly appreciated :) |
@dikbek I'm sorry man, there has to be something else... Here's my quick test: package.json:
vite.config.js:
index.html:
index.js:
index.glsl:
chunk.glsl:
Output: Am I missing something? |
Thanks again @UstymUkhman. I doubt you're missing anything. It's me that's missing something. I tried to recreate your test but getting other errors, maybe to do with my lack of 'env.mjs'. I'm feeling so out of my depth here. Not sure what to do, but I guess I'll have to try set up a fresh vite/svelte startup folder and try again. Feel like I've wasted your time a bit here. Clearly just my lack of general understanding playing out. Thanks anyway. Will let you know if I have any success. |
No problem for my time (it was just 30 minutes). Sure, let me know if you'll have any updates on the fresh project where I can help you. :) |
@UstymUkhman thank you again for all the help. |
@Vanderscycle @dikbek How this thing is going? Is the issue still present? Do you have any updates that might be useful to me in helping you guys? |
Hi @UstymUkhman, I must admit I still haven't managed to solve it. I had to give up and carry on - my glsl usage is pretty minimal so I just included it in the js. I have a repo where the error lies - it's on the page 'portal'. I am hoping maybe you can take a look and let me know what you think is wrong with my setup? Any help would be greatly appreciated. |
Hi @dikbek . I've checked you repo (cool tutorials from Bruno, btw...) and created a pull request to fix shader imports on the portal page. Two things there:
Please let me know if there still a problem I've missed or if I can close this issue as it seems that the original error was solved. Cheers! |
Hi @UstymUkhman, Thanks a million, it's working! Legendary! Ok, I understand now. It was so simple. Thanks for your patience! Great job on fixing the plugin. It is very much appreciated! One last thing - Do you think it could become a problem that I'm not using type: module? |
Hi @dikbek , thanks, no problem, I'm glad I could help. :) Regarding the That might actually lead to the problem you had with this plugin 'cause, as you can see here, I'm compiling typescript source code as
but, when using
You can find more info about https://nodejs.org/api/packages.html#packagejson-and-file-extensions Cheers! |
Hey,
Thank you for making this vite plugins to better manage file imports. However, I need your help as I can't seem to get working, even after following the README.md and ensuring that the npm packages was saved as a dev dependency.
I am currently getting the following error related to this plugin regardless of vite dev/build.
The current vite.config.js implementation is simple for now:
Any help is greatly appreciated,
@dikbek, pinging you for tracking
The text was updated successfully, but these errors were encountered: