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

bug: Ionic doesn't work with Vite (anything except webpack) #22924

Closed
haikyuu opened this issue Feb 15, 2021 · 12 comments
Closed

bug: Ionic doesn't work with Vite (anything except webpack) #22924

haikyuu opened this issue Feb 15, 2021 · 12 comments
Labels

Comments

@haikyuu
Copy link

haikyuu commented Feb 15, 2021

I'm trying to use Ionic in my app along with Vite.

But I'm getting a 404 http://localhost:3000/node_modules/.vite/ion-app_8.entry.js?import

You can try it out immediately here https://repl.it/@abdellah/vite-ionic-1 and here is its github repo https://github.com/haikyuu/vite-ionic

How can I use Vite with Ionic?

@ionitron-bot ionitron-bot bot added the triage label Feb 15, 2021
@remorses
Copy link

This is a problem with @stencil/core

It is importing dynamically some modules and vite cannot statically analyze these imports

The problem is probably here
https://github.com/ionic-team/stencil/blob/cfd5d39bad4ce2cab431595ae8c8f11d1fabb192/src/client/client-load-module.ts#L23

@remorses
Copy link

Created an issue at ionic-team/stencil#2827

@haikyuu haikyuu changed the title bug: Ionic doesn't work with Vite bug: Ionic doesn't work with Vite (anything except webpack) Feb 16, 2021
@haikyuu
Copy link
Author

haikyuu commented Feb 16, 2021

It seems like Ionic is coupled to Webpack

It doesn't seem possible to use Ionic with Rollup, Vite or snowpack to name a few.

It's worth noting that Vite is becoming the defacto bundler for Vue projects and A lot of react projects are using it.

Workarounds exist for Snowpack but they suggest using a CDN. But this is not reasonable for building mobile apps!

@liamdebeasi
Copy link
Contributor

Thanks for the issue. The problem here is the fact that we rely on Stencil's lazy loading solution as noted in #22924 (comment).

We have a "Custom elements" build of Ionic Framework coming soon that does not use this lazy loading which will make the framework much easier to use with Rollup, Vite, etc. Keep an eye out for an announcement regarding this!

I am going to close this issue in favor of ionic-team/stencil#2827.

@haikyuu
Copy link
Author

haikyuu commented Feb 18, 2021

That's great news. Thanks @liamdebeasi

@lzm0x219
Copy link

This issue was not resolved.

@haikyuu
Copy link
Author

haikyuu commented Mar 22, 2021

Definitely! I guess this means it will be a won't fix ?!

Too bad for Ionic. Rollup and vite have a big portion of projects especially new ones. Webpack is a tool of the past.

@liamdebeasi
Copy link
Contributor

Hi there, as per my comment in #22924 (comment) I noted that I was closing this issue in favor of ionic-team/stencil#2827. (Our automated bot closed this out, but I reopened it because it should not have done that).

Work is already underway to support this and we will have more to share soon. Thanks!

@reslear
Copy link

reslear commented Apr 6, 2021

@liamdebeasi Hi, thank you 🙏 but is planned before 2022?

@liamdebeasi
Copy link
Contributor

I don't have a specific date to share, but yes we do plan on doing this before 2022.

@stewones
Copy link
Contributor

seems like everyone is switching to vite, I think you guys could make this a priority and ship sooner.

@ionitron-bot
Copy link

ionitron-bot bot commented May 28, 2021

Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Ionic, please create a new issue and ensure the template is fully filled out.

@ionitron-bot ionitron-bot bot locked and limited conversation to collaborators May 28, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

6 participants