Skip to content

fix(build): publicAssets priority on build - #819

Closed
antfu wants to merge 1 commit into
mainfrom
fix/public-assets-2
Closed

antfu wants to merge 1 commit into
mainfrom
fix/public-assets-2

Conversation

@antfu

@antfu antfu commented Jan 9, 2023

Copy link
Copy Markdown
Member

🔗 Linked issue

❓ Type of change

  • 📖 Documentation (updates to the documentation or readme)
  • 🐞 Bug fix (a non-breaking change that fixes an issue)
  • 👌 Enhancement (improving an existing functionality like performance)
  • ✨ New feature (a non-breaking change that adds functionality)
  • ⚠️ Breaking change (fix or feature that would cause existing functionality to change)

📚 Description

#817 was not a complete fix. As Vite will make an initial copy for the public file, ignoring overrides will instead keep the version from Vite's initial copy.

📝 Checklist

  • I have linked an issue or discussion.
  • I have updated the documentation accordingly.

@antfu
antfu requested a review from pi0 January 9, 2023 12:23
@pi0

pi0 commented Jan 9, 2023

Copy link
Copy Markdown
Member

I was going to suggest this method instead from previous PR but it was more performant by avoiding extra copy-override operations.

Is there a way to fix nuxt-vite behavior by not copying the assets? A quick workaround would be cleanup output/public just before starting copy but it had also benefit of supporting edge cases for custom override. So i prefer if fixing vite and otherwise cleanup with previous PR.

@antfu

antfu commented Jan 9, 2023

Copy link
Copy Markdown
Member Author

I think we could disable the public copy for Vite, but I am afraid it will affect how asset paths are resolved by Vite. Removing the public before copy might not work as Vite will merge the bundle and assets, which would be hard to identify.

I will do a bit more research to see if it's possible on Vite side.

@antfu

antfu commented Jan 9, 2023

Copy link
Copy Markdown
Member Author

It seems there is a copyPublicDir options introduced for SvelteKit, close in favor of nuxt/framework#10013

This branch was successfully deployed

1 active deployment
Preview — f667c5b9 Deployed Jan 9, 2023 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants