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

assetsInlineLimit not being set in Vite 6 #28

Open
halljus opened this issue Jan 23, 2025 · 0 comments
Open

assetsInlineLimit not being set in Vite 6 #28

halljus opened this issue Jan 23, 2025 · 0 comments

Comments

@halljus
Copy link

halljus commented Jan 23, 2025

Hey @AlemTuzlak, thanks for all your work in the Remix/RR ecosystem! 👋

The assetsInlineLimit override for the spritesheet is not happening in Vite 6 (RRv7), as far as I can tell. I glanced at the Vite 6 migration and plugin API docs and didn't see any changes that should have affected this, so maybe it's a bug in Vite itself but figured I'd start here.

vite-plugin-icons-spritesheet's configResolved function does run, and it does change the build.assetsInlineLimit from the default 4096 value to the function you specified, but that function doesn't run AFAICT.

Aside I couldn't the plugin's function to run in Vite 5 either, even though the plugin works great there - so perhaps my debugging approach is flawed. I replaced the plugin code with
config.build.assetsInlineLimit = (name, content) => { throw new Error('This error never happens. Wut?'); };
and it never threw, so apparently I have no idea how this works at all, even in Vite 5. Maybe Vite catches errors like these and silently falls back to default values. Anyway...

Configuring Vite directly does work:

// vite.config.ts 👍
build: {
  assetsInlineLimit(filePath) {
    return !filePath.endsWith('icons-sprite.svg');
  }
}

But the plugin's automatic handling of assetsInlineLimit doesn't. 🙁

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

No branches or pull requests

1 participant