Skip to content

fix: exclude external dependencies from html rewriting#11854

Closed
leonheess wants to merge 1 commit intovitejs:mainfrom
leonheess:main
Closed

fix: exclude external dependencies from html rewriting#11854
leonheess wants to merge 1 commit intovitejs:mainfrom
leonheess:main

Conversation

@leonheess
Copy link

@leonheess leonheess commented Jan 30, 2023

@leonheess
Copy link
Author

@bluwy we have a project with 100+ devs waiting on this fix, is there a way to accelerate this? :)

@vividvilla
Copy link

Waiting on this one to be merged

@Niputi Niputi added feat: html p3-minor-bug An edge case that only affects very specific usage (priority) labels Mar 23, 2023
@bluwy
Copy link
Member

bluwy commented Apr 7, 2023

I've added this to the team board for discussion. I'm unsure if this is the way we want to support externalizing things, because now a build option would affect a non-build flow, and this could indirectly expand to other flows if we don't define a scope.

This will also be indirectly covered by #11138 (comment). I've bumped up the priority on this for the next meeting.

@bluwy
Copy link
Member

bluwy commented May 14, 2023

In a recent meeting, we decided to go with resolve.external as the way of configuring things as external in dev and build. The feature is tracked at #6582. Supporting that would need some work, so it might take a while to get that done first before we can merge this. (Or if the implementation would fix this together)

@leonheess
Copy link
Author

@bluwy we have multiple teams waiting on this, can you maybe give some timeline?

@bluwy
Copy link
Member

bluwy commented Aug 18, 2023

Hi, sorry for the wait. We don't usually have timelines for features as the project is community supported. However, I might try to take a stab at this for Vite 5. There's been a couple things I'd like to do and this is one of it. I'll put this on the Vite 5 milestone so we track it.

@bluwy bluwy added this to the 5.0 milestone Aug 18, 2023
@bluwy
Copy link
Member

bluwy commented Oct 18, 2023

I tried to implement resolve.external recently, but it became harder than expected. Not only we need to match rollupOptions.external, but also ssr.external. And there's multiple design questions such as:

  1. Should they work mutually exclusive?
  2. Or they work together, but how do we make it work predictably?
  3. Should resolve.external be preferred over rollupOptions, or merged?

And it's also touching a lot of the codebase. At the moment, we're quite behind on the Vite 5 schedule so we'll have to unfortunately tackle this in a minor in the future. Dropping this off the milestone for now.

@bluwy bluwy removed this from the 5.0 milestone Oct 18, 2023
@leonheess
Copy link
Author

hi @bluwy, that's not good news. Is there an amount of money that could change that decision?

@bluwy
Copy link
Member

bluwy commented Oct 18, 2023

Thanks for the offer. I won't speak for the other team members, for me I'm limited on bandwidth currently to implement it even with so. With that said, if we manage to slim down the milestone by next week, I could also have time to revisit this.

It's also moved out of the milestone for now as it's not a breaking change we have to fit into Vite 5. The new external feature would be non-breaking, and "excluding html rewriting" would depend on the feature, so it's overall opt-in and we can do so post-Vite 5.

@leonheess
Copy link
Author

okay, let me know if we can help. AFAIK we are already sponsoring Vue and Vite to some extent but we would definitely be interested in paying more to resolve this specific issue :)

@olamedia
Copy link

olamedia commented Oct 9, 2024

No accepted solution for years? May be for your current users this is minor, because they already removed external dependencies or wrote workarounds, but for migrating applications with multiple repositories to Vite it's critical.
"An edge case that only affects very specific usage" - the users who can't use vite because of this bug.

@olamedia
Copy link

olamedia commented Oct 9, 2024

I guess, checkPublicFile should not check if file exists. Then /some.png can become ./public/some.png and back to /some.png without checking existence.

Missing files are served via proxy option on localhost, and by custom server setup in production (serving assets by one urls, and app by another)

#18315

@leonheess
Copy link
Author

@yyx990803, you are my last hope! we are ready to pay for this 😭😭

@Xenossolitarius
Copy link

@leonheess yea the scope of this feature goes a bit beyond your code. If you update it to ignore relative paths and to make alias changes and to differentiate SSR and client side, they will probably merge it instantly, but as it is I don't believe they will make a move on this. They will probably make this move when they introduce rolldown to vite which may happen a lot later. I was actually thinking doing this right now bcs I have a project in mind: SSR microfrontend framework but i am still weighing if just creating a plugin is good enough for my usecase

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feat: html p3-minor-bug An edge case that only affects very specific usage (priority)

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

6 participants