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

Vite Pre-transform error after upgrade #447

Open
Mousaka opened this issue Jan 13, 2024 · 9 comments
Open

Vite Pre-transform error after upgrade #447

Mousaka opened this issue Jan 13, 2024 · 9 comments

Comments

@Mousaka
Copy link

Mousaka commented Jan 13, 2024

Problem

After upgrade elm pages to 10.0.3 and vite to "^5.0.11" I started getting this error in my project on page loads on the dev server. I get the same error both in my personal project and in elm-pages-starter.

[vite] Pre-transform error: Failed to load url /elm-pages.js (resolved id: /elm-pages.js). Does the file exist? (x2)
1 /: 35.617ms

The site still runs and elm-pages.js gets downloaded without errors in the browser.

Search results

Found this Issue on another project which might be related storybookjs/storybook#25256 . Seems like it has to do with some change in version 5 of vite.
This was the "fix" they did in that project https://github.com/storybookjs/storybook/pull/25329/files . Not sure how and if this translates to elm-pages or if it's related at all.

Workaround

From/inspired by vitejs/vite#15374 (comment)

// in elm-pages.config.mjs
  vite: defineConfig({
    assetsInclude: ['/elm-pages.js']
  }),
@Mousaka
Copy link
Author

Mousaka commented Jan 13, 2024

Some more digging. Maybe a fix is on its way vitejs/vite#15354 (comment)
Edit the fix for this seems to have been merged in 5.0.11 already so it probably did not help us vitejs/vite#15361

@dillonkearns
Copy link
Owner

Oh nice, that's very helpful! Thank you for looking into that and saving me the time @Mousaka! 🙏

@Mousaka
Copy link
Author

Mousaka commented Jan 19, 2024

Updated the issue:

  1. Added a workaround I found.
  2. Added to problem description that I do not only get this in my personal project, I also get it in elm-pages-starter.

@dillonkearns
Copy link
Owner

Edit the fix for this seems to have been merged in 5.0.11 already so it probably did not help us vitejs/vite#15361

How do you know it endedd up in 5.0.11?

@dillonkearns
Copy link
Owner

I couldn't tell immediately from looking at the issue which release it would be a part of. Worth checking and seeing when the next release comes out if it's fixed.

@dillonkearns
Copy link
Owner

Oh yes, I see it now in https://github.com/vitejs/vite/blob/v5.0.12/packages/vite/CHANGELOG.md#5011-2024-01-05.

Strange that it's still there then. Maybe not related to that fix at all.

@dillonkearns
Copy link
Owner

I'm not sure why this is needed now, but it's easy enough to add that to the built-in Vite defaults so I'll go ahead and do that. Thanks for figuring out the fix!

@dillonkearns
Copy link
Owner

This will go out with the next elm-pages release.

@dillonkearns
Copy link
Owner

Looks like that Vite fix didn't resolve it, but I believe this open Vite issue tracks the problem: vitejs/vite#6582

@dillonkearns dillonkearns reopened this Apr 21, 2024
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

2 participants