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

The spritesheet url sometimes comes with wrong data #39

Open
lichomonjelat opened this issue Apr 30, 2024 · 4 comments
Open

The spritesheet url sometimes comes with wrong data #39

lichomonjelat opened this issue Apr 30, 2024 · 4 comments

Comments

@lichomonjelat
Copy link

Hi there @mcansh! I'been implementing your plugin on my remix js app, locally it works fine, each icon renders it's all good, but when the time for testing in the qa environment arrived, we found out several problems, the icons aren't loading correctly, some of them do, but others don't, i have a few hydration errors on my console (maybe it's a problem on my end) and i keep getting a 404 on the spritesheet, sometimes the request is ok (200) but most of the time it does not work. It tries to get the default spritesheet without the hash and it keeps getting 404, maybe that's a reason why the icons are not rendering correctly. And other thing that i've found out is when you make a navigation, this error happens too, it tries to get the default spritesheet name instead of the hashed one.
Captura de pantalla 2024-04-30 a la(s) 10 39 04 a  m
Captura de pantalla 2024-04-30 a la(s) 10 42 19 a  m

@mcansh
Copy link
Owner

mcansh commented Apr 30, 2024

hi @lichomonjelat do you have a reproduction repo? i know you said in your QA environment it happens, but does it also happen locally when you do npm run build and npm run start?

@lichomonjelat
Copy link
Author

hi @lichomonjelat do you have a reproduction repo? i know you said in your QA environment it happens, but does it also happen locally when you do npm run build and npm run start?

Hi @mcansh! yes, it happens too if i run the prod build locally
Captura de pantalla 2024-05-01 a la(s) 9 24 10 a  m

but if i hit refresh, it does load it from the cache
Captura de pantalla 2024-05-01 a la(s) 9 24 48 a  m

@jcheese1
Copy link

@lichomonjelat this is what I have for the moment inside vite.config.js:

  build: {
    rollupOptions: {
      output: {
        assetFileNames: (file) => {
          if (file.name.endsWith(".svg")) {
            return "assets/[name].[ext]";
          }
          return 'assets/[name]-[hash].[ext]';
        }
      }
    }
  },

this will not append the hash if its a svg.

@mcansh
Copy link
Owner

mcansh commented Aug 29, 2024

definitely something happening in the writeBundle method were im going through the emitted files and updating the sprite url, havent had a chance to look into it unfortunately. also need to tweak something for the warning about emitFile and serve mode, but that should be unrelated to this issue

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

3 participants