ElMassimo / vite_ruby

⚑️ Vite.js in Ruby, bringing joy to your JavaScript experience
https://vite-ruby.netlify.app/
MIT License
1.28k stars 117 forks source link

Can't find SVG file in manifest after upgrade to 3.5.0 #429

Closed JasonBarnabe closed 6 months ago

JasonBarnabe commented 7 months ago

Description πŸ“–

After upgrading vite_ruby from 3.3.4 to 3.5.0, I'm getting an error while rendering pages: ActionView::Template::Error:"Vite Ruby can't find site/pages/cart/images/browser-redirect.svg in the manifests.. The generated flies at public/packs/vite/.vite/manifest.json and public/packs/vite/.vite/manifest-assets.json do not contain a reference to this file.

It should be included because:

On build, I see the message: Generated an empty chunk: "app/components/payment_processor/stripe_fields_component_controller.js"., however if I adjust the file to contain some actual JS and rebuild, I still get the error about the missing SVG.

This all worked on 3.3.4.

Reproduction 🐞

Repo is private, but I can provide some snippets or run debug commands if it's helpful.

Vite Ruby Info _Run `bin/rake vite:info` and provide the output:_ ``` bin/vite present?: true vite_ruby: 3.5.0 vite_rails: 3.0.17 rails: 7.0.8 node: v20.11.0 npm: 10.2.4 yarn: 1.22.5 pnpm: 7.14.2 ruby: ruby 3.2.2 (2023-03-30 revision e51014f9c0) [x86_64-linux] installed packages: Simplero@0.0.20 /www/Simplero β”œβ”€β”¬ @vitejs/plugin-react@4.2.1 β”‚ └── vite@5.0.11 deduped β”œβ”€β”¬ vite-plugin-mkcert@1.13.3 β”‚ └── vite@5.0.11 deduped β”œβ”€β”¬ vite-plugin-relay@2.0.0 β”‚ └── vite@5.0.11 deduped β”œβ”€β”¬ vite-plugin-ruby@5.0.0 β”‚ └── vite@5.0.11 deduped └── vite@5.0.11 ```
JuanVqz commented 6 months ago

hey @JasonBarnabe did you solve it?

it seems related to this https://github.com/vitejs/vite/issues/15010

More info

If you are using vite.config.ts update it to vite.config.mts

JasonBarnabe commented 6 months ago

Thanks for the suggestion, but that did not solve the issue.

We ended up adding the path to additionalEntrypoints in vite.json and removing the import. Still not sure why this changed in 3.5.0.