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

Migrate to Vite 3 ⚡️ #3570

Merged
merged 46 commits into from
Jul 19, 2022
Merged

Migrate to Vite 3 ⚡️ #3570

merged 46 commits into from
Jul 19, 2022

Conversation

matthewp
Copy link
Contributor

@matthewp matthewp commented Jun 10, 2022

Changes

This bumps Vite to the next major version. Still in beta, but we need to align this week so Astro 1.0 is aligned with Vite!

  • Update middlewareMode to new API
  • Slay the legendary ALWAYS_EXTERNAL array 🥳
  • Check whether packages are installed before adding to the ssr.noExternal array. Vite 3 now errors out when attempting to ssr.noExternal a package that is not installed, so we need a manual check on our end.
  • Update ssr.noExternal for relevant example projects. external is the default, so we'll need this fix more often than before now.
  • Flip on legacy.devDepsScanner to revert to Vite 2.X dev experience. Otherwise, non-hydrated components will fail to hot-update without a manual page refresh. The Vite team confirmed this flag will be around for a few months, but let's track this for the near term! Vite 3 reverted this change for their stable release! Sounds like they'll revisit for Vite 4 though, so keep this in mind with new HMR work.

Testing

Add package.json across integration test fixtures. This prevents any ssr.noExternal failures for nested Astro dependencies

Docs

TODO - Vite 3 migration guide!

@changeset-bot
Copy link

changeset-bot bot commented Jun 10, 2022

🦋 Changeset detected

Latest commit: 247494e

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 12 packages
Name Type
astro Minor
@astrojs/image Minor
@astrojs/svelte Minor
@astrojs/vue Minor
@e2e/astro-component Patch
@e2e/lit-component Patch
@e2e/preact-component Patch
@e2e/react-component Patch
@e2e/solid-component Patch
@e2e/svelte-component Patch
@e2e/e2e-tailwindcss Patch
@e2e/ts-resolution Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions github-actions bot added the pkg: astro Related to the core `astro` package (scope) label Jun 10, 2022
@patak-dev
Copy link

Thanks for quicking this out! Just sent a PR to point vite-ecosystem-ci to this branch, so we get reports in Vite Land.

Link to the latest migration guide from v2: https://github.com/vitejs/vite/blob/main/docs/guide/migration.md

@bholmesdev bholmesdev force-pushed the vite-3 branch 6 times, most recently from edc897c to 6b5efd0 Compare June 27, 2022 21:13
@github-actions github-actions bot added the pkg: integration Related to any renderer integration (scope) label Jun 27, 2022
@bholmesdev bholmesdev force-pushed the vite-3 branch 2 times, most recently from eebb21b to 72da034 Compare June 27, 2022 21:27
@github-actions github-actions bot removed the pkg: integration Related to any renderer integration (scope) label Jun 27, 2022
@patak-dev
Copy link

We just saw Astro 🟢 for the first time with Vite v3 in #ecosystem-ci. Thanks a lot for all your efforts here @bholmesdev 🙌🏼

@github-actions github-actions bot added the 🚨 action Modifies GitHub Actions label Jun 28, 2022
@bholmesdev bholmesdev force-pushed the vite-3 branch 2 times, most recently from 4472f9e to 34d21f1 Compare June 28, 2022 14:59
@github-actions github-actions bot added the pkg: create-astro Related to the `create-astro` package (scope) label Jun 28, 2022
@bholmesdev bholmesdev force-pushed the vite-3 branch 2 times, most recently from 5157be9 to dbce9b5 Compare June 28, 2022 17:47
@github-actions github-actions bot removed the pkg: create-astro Related to the `create-astro` package (scope) label Jun 28, 2022
@bholmesdev bholmesdev marked this pull request as ready for review June 28, 2022 18:14
@bholmesdev bholmesdev changed the title Vite 3 test Migrate to Vite 3 ⚡️ Jun 28, 2022
@github-actions github-actions bot added pkg: vue Related to Vue (scope) pkg: integration Related to any renderer integration (scope) and removed 🚨 action Modifies GitHub Actions labels Jun 28, 2022
Copy link
Member

@natemoo-re natemoo-re left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great! Had a few comments.

@@ -136,7 +136,7 @@
"strip-ansi": "^7.0.1",
"supports-esm": "^1.0.0",
"tsconfig-resolver": "^3.0.1",
"vite": "^2.9.14",
"vite": "3.0.0",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any reason to pin to 3.0.0 exactly? Should we use ~3.0.0?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ack, didn't catch this! I'm using ^3.0.0 but would we prefer ~3.0.0?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I’m almost sure they’re following semver, but given all the noise around this release I’d be +1 to use ~ until 3.x has had some time to bake. Don’t feel too strongly tho

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choosing to keep ^3.0.0. Using ~3.0.0 is one more thing to question and circle back to. I trust the Vite team here 😁

packages/astro/src/core/create-vite.ts Outdated Show resolved Hide resolved
packages/astro/test/test-utils.js Outdated Show resolved Hide resolved
@matthewp
Copy link
Contributor Author

lgtm, glad to see no nasty regexes required!

Copy link
Member

@FredKSchott FredKSchott left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@FredKSchott
Copy link
Member

Be it so ordered, by the power vested in me by fredkbot, I deem this PR merged. 🔨

@FredKSchott FredKSchott merged commit 04070c0 into main Jul 19, 2022
@FredKSchott FredKSchott deleted the vite-3 branch July 19, 2022 05:19
@astrobot-houston astrobot-houston mentioned this pull request Jul 19, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pkg: astro Related to the core `astro` package (scope) pkg: example Related to an example package (scope) pkg: integration Related to any renderer integration (scope) pkg: svelte Related to Svelte (scope) pkg: vue Related to Vue (scope)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants