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

Update Vite to 5.x, accommodate ESM-only exports in Vite #6939

Merged
merged 4 commits into from
Jul 10, 2024
Merged

Conversation

hl662
Copy link
Contributor

@hl662 hl662 commented Jul 5, 2024

Update display-test-app and display-performance-test-app to Vite 5.x.
Migration guide from Vite.
Notable, impacted changes from the guide above involves Vite dropping CJS support of their modules, and only exporting ESM.

Solutions are documented in Vite's official migration page, one involved changing package.json's type: module, one involved changing vite.config.ts to vite.config.mts.

I chose the latter, and here are the following changes:

  • esbuild-plugin-external-global is CJS only, so I've removed the use of that, and switched to rollup-plugin-external-globals
  • require.resolve doesn't work by default, the solution I chose is to use createRequire from the module module. There's also an experimental import.meta.resolve(), but it's not a 1-1 implementation of require.resolve(), and the former is a more stable solution. We can look into using import.meta.resolve() in the future when it's not flagged as experimental.

@hl662 hl662 self-assigned this Jul 5, 2024
@hl662 hl662 requested review from a team and bbastings as code owners July 5, 2024 15:40
@hl662 hl662 marked this pull request as draft July 5, 2024 15:47
@hl662 hl662 marked this pull request as ready for review July 10, 2024 13:01
@hl662
Copy link
Contributor Author

hl662 commented Jul 10, 2024

Fixed the issue with the app's build - @DStradley can you run the image tests to verify no regressions?

@hl662 hl662 enabled auto-merge (squash) July 10, 2024 17:59
@DStradley
Copy link
Contributor

Fixed the issue with the app's build - @DStradley can you run the image tests to verify no regressions?

Started ImageTest run with your branch.

@DStradley
Copy link
Contributor

ImageTests looked good.

@hl662 hl662 merged commit 92168d4 into master Jul 10, 2024
15 checks passed
@hl662 hl662 deleted the nam/update-vite branch July 10, 2024 22:37
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.

None yet

3 participants