Skip to content
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

Failed to resolve import #1755

Closed
2 tasks done
anncwb opened this issue Jan 28, 2021 · 5 comments
Closed
2 tasks done

Failed to resolve import #1755

anncwb opened this issue Jan 28, 2021 · 5 comments

Comments

@anncwb
Copy link
Contributor

anncwb commented Jan 28, 2021

⚠️ IMPORTANT ⚠️ Please check the following list before proceeding. If you ignore this issue template, your issue will be directly closed.

  • Read the docs.
  • Use Vite >=2.0. (1.x is no longer supported)

Describe the bug

Sorry, I can’t provide a streamlined reproduction project for this error, because I can’t restore it on a streamlined project

After I upgraded from beta.50 to beta.51, the project no longer runs normally, do I need to modify anything?

Reproduction

Here I provide my project, but the content of the project is rather complicated,

An error occurred on the command line

image

An error occurred in the browser console

image

System Info

  • vite version: beta.51
  • Operating System: mac
  • Node version: 14
  • Package manager (npm/yarn/pnpm) and version:yarn

Logs (Optional if provided reproduction)

  1. Run vite or vite build with the --debug flag.
  2. Provide the error log here.
@hpx7
Copy link
Contributor

hpx7 commented Jan 28, 2021

I'm seeing the same thing in the browser console after upgrading to beta.51:

The requested module 'node_modules/protobufjs/dist/protobuf.js' does not provide an export named 'load'

I'm providing this package with an alias:

alias: { protobufjs: "protobufjs/dist/protobuf.js" }

EDIT: protobufjs used to come from a package linked using optimizeDeps.link, which I removed after upgrading to beta.51 -- is Vite supposed to auto-link it for me now?

@yyx990803
Copy link
Member

yyx990803 commented Jan 28, 2021

beta.51 auto discovers deps now.

@anncwb you have a plugin that is returning virtual file for @purge-icons/generated... which then imports @iconify/iconify. Because iconify is in a virtual file, it can only be detected after the page is loaded. I think Vite should make this case work but for now you can add @iconify/iconify to optimizeDeps.include. (btw I don't know if the other includes are still necessary, I removed them and it seems to just work)

@anncwb
Copy link
Contributor Author

anncwb commented Jan 28, 2021

beta.51 auto discovers deps now.

@anncwb you have a plugin that is returning virtual file for @purge-icons/generated... which then imports @iconify/iconify. Because iconify is in a virtual file, it can only be detected after the page is loaded. I think Vite should make this case work but for now you can add @iconify/iconify to optimizeDeps.include. (btw I don't know if the other includes are still necessary, I removed them and it seems to just work)

thank you very much. After beta.52 is released, I will be testing

@hpx7
Copy link
Contributor

hpx7 commented Jan 28, 2021

This may have been fixed now, but just wanted to say that restarting the server fixes the issue for me -- once node_modues/.vite is on disk everything runs fine.

@hpx7
Copy link
Contributor

hpx7 commented Jan 28, 2021

I can confirm this is fixed in beta.52. The auto discovery is super cool by the way!

@github-actions github-actions bot locked and limited conversation to collaborators Jul 16, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants