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

fix(deps): update dependency vite to v5 #10167

Closed
wants to merge 23 commits into from
Closed
Show file tree
Hide file tree
Changes from 9 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 4 additions & 0 deletions packages/cli/src/commands/buildHandler.js
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,10 @@ export const handler = async ({
// it could affect other things that run in parallel while building.
// We don't have any parallel tasks right now, but someone might add
// one in the future as a performance optimization.
//
// Disable the new warning in Vite v5 about the CJS build being deprecated
// so that users don't have to see it when this command is called with --verbose
process.env.VITE_CJS_IGNORE_WARNING = 'true'
Comment on lines +137 to +140
Copy link
Contributor

@jtoar jtoar Mar 9, 2024

Choose a reason for hiding this comment

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

Vite 5 deprecated the CJS api. The only place the CJS api is used is in a user's vite.config.ts file. We can disable the warning with https://github.com/vitejs/vite/blob/504bc5f80888ebd89d6c6726b18cb6f322ed538f/packages/vite/index.cjs#L29.

await execa(
`node ${require.resolve(
'@redwoodjs/vite/bins/rw-vite-build.mjs'
Expand Down
4 changes: 4 additions & 0 deletions packages/cli/src/commands/devHandler.js
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,10 @@ export const handler = async ({
// Written this way to make it easier to read

// 1. default: Vite (SPA)
//
// Disable the new warning in Vite v5 about the CJS build being deprecated
// so that users don't have to see it every time the dev server starts up.
process.env.VITE_CJS_IGNORE_WARNING = 'true'
let webCommand = `yarn cross-env NODE_ENV=development rw-vite-dev ${forward}`

// 2. Vite with SSR
Expand Down
2 changes: 1 addition & 1 deletion packages/vite/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@
"isbot": "3.7.1",
"react": "0.0.0-experimental-e5205658f-20230913",
"react-server-dom-webpack": "0.0.0-experimental-e5205658f-20230913",
"vite": "4.5.2",
"vite": "5.1.5",
"vite-plugin-cjs-interop": "2.1.0",
"yargs-parser": "21.1.1"
},
Expand Down
6 changes: 3 additions & 3 deletions packages/vite/src/lib/getMergedConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,11 +118,11 @@ export function getMergedConfig(rwConfig: Config, rwPaths: Paths) {
? rwPaths.web.distClient
: rwPaths.web.dist,
emptyOutDir: true,
manifest: !env.ssrBuild ? 'client-build-manifest.json' : undefined,
manifest: !env.isSsrBuild ? 'client-build-manifest.json' : undefined,
// Note that sourcemap can be boolean or 'inline'
sourcemap: !env.ssrBuild && rwConfig.web.sourceMap,
sourcemap: !env.isSsrBuild && rwConfig.web.sourceMap,
rollupOptions: {
input: getRollupInput(!!env.ssrBuild),
input: getRollupInput(!!env.isSsrBuild),
Comment on lines -121 to +125
Copy link
Contributor

@jtoar jtoar Mar 9, 2024

Choose a reason for hiding this comment

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

One of the breaking changes; ssrBuild was renamed to isSsrBuild. See vitejs/vite#14855

},
},
// @MARK: do not set buildSsrCjsExternalHeuristics here
Expand Down
3 changes: 0 additions & 3 deletions packages/vite/src/rsc/rscBuildAnalyze.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,6 @@ export async function rscBuildAnalyze() {
},
},
},
legacy: {
buildSsrCjsExternalHeuristics: true,
},
})

const clientEntryFiles = Object.fromEntries(
Expand Down
4 changes: 0 additions & 4 deletions packages/vite/src/rsc/rscBuildForServer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,6 @@ export async function rscBuildForServer(
// TODO (RSC): No redwood-vite plugin, add it in here
const rscServerBuildOutput = await viteBuild({
envFile: false,
legacy: {
// @MARK: for the worker, we're building ESM! (not CJS)
buildSsrCjsExternalHeuristics: false,
},
Comment on lines -40 to -43
Copy link
Contributor

Choose a reason for hiding this comment

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

This is gone in Vite v5; see vitejs/vite#13816

ssr: {
// Externalize everything except packages with files that have
// 'use client' in them (which are the files in `clientEntryFiles`)
Expand Down
64 changes: 12 additions & 52 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -8794,7 +8794,7 @@ __metadata:
rollup: "npm:3.29.4"
tsx: "npm:4.6.2"
typescript: "npm:5.3.3"
vite: "npm:4.5.2"
vite: "npm:5.1.5"
vite-plugin-cjs-interop: "npm:2.1.0"
vitest: "npm:1.2.2"
yargs-parser: "npm:21.1.1"
Expand Down Expand Up @@ -17747,7 +17747,7 @@ __metadata:
languageName: node
linkType: hard

"esbuild@npm:^0.18.0, esbuild@npm:^0.18.10, esbuild@npm:~0.18.20":
"esbuild@npm:^0.18.0, esbuild@npm:~0.18.20":
version: 0.18.20
resolution: "esbuild@npm:0.18.20"
dependencies:
Expand Down Expand Up @@ -27912,14 +27912,14 @@ __metadata:
languageName: node
linkType: hard

"postcss@npm:^8.2.14, postcss@npm:^8.4.21, postcss@npm:^8.4.24, postcss@npm:^8.4.27, postcss@npm:^8.4.32":
version: 8.4.33
resolution: "postcss@npm:8.4.33"
"postcss@npm:^8.2.14, postcss@npm:^8.4.21, postcss@npm:^8.4.24, postcss@npm:^8.4.35":
version: 8.4.35
resolution: "postcss@npm:8.4.35"
dependencies:
nanoid: "npm:^3.3.7"
picocolors: "npm:^1.0.0"
source-map-js: "npm:^1.0.2"
checksum: 10c0/16eda83458fcd8a91bece287b5920c7f57164c3ea293e6c80d0ea71ce7843007bcd8592260a5160b9a7f02693e6ac93e2495b02d8c7596d3f3f72c1447e3ba79
checksum: 10c0/e8dd04e48001eb5857abc9475365bf08f4e508ddf9bc0b8525449a95d190f10d025acebc5b56ac2e94b3c7146790e4ae78989bb9633cb7ee20d1cc9b7dc909b2
languageName: node
linkType: hard

Expand Down Expand Up @@ -29662,7 +29662,7 @@ __metadata:
languageName: node
linkType: hard

"rollup@npm:3.29.4, rollup@npm:^3.27.1":
"rollup@npm:3.29.4":
version: 3.29.4
resolution: "rollup@npm:3.29.4"
dependencies:
Expand Down Expand Up @@ -33199,53 +33199,13 @@ __metadata:
languageName: node
linkType: hard

"vite@npm:4.5.2":
version: 4.5.2
resolution: "vite@npm:4.5.2"
dependencies:
esbuild: "npm:^0.18.10"
fsevents: "npm:~2.3.2"
postcss: "npm:^8.4.27"
rollup: "npm:^3.27.1"
peerDependencies:
"@types/node": ">= 14"
less: "*"
lightningcss: ^1.21.0
sass: "*"
stylus: "*"
sugarss: "*"
terser: ^5.4.0
dependenciesMeta:
fsevents:
optional: true
peerDependenciesMeta:
"@types/node":
optional: true
less:
optional: true
lightningcss:
optional: true
sass:
optional: true
stylus:
optional: true
sugarss:
optional: true
terser:
optional: true
bin:
vite: bin/vite.js
checksum: 10c0/68969ccf72ad2078aec7d9e023fce6de03746a4761f9308924212fff7bd42487145b270166cec66cddacfd7b1315ec5aa39ead174fbd7fcd463637a96ff4c9d1
languageName: node
linkType: hard

"vite@npm:^5.0.0":
version: 5.0.12
resolution: "vite@npm:5.0.12"
"vite@npm:5.1.5, vite@npm:^5.0.0":
version: 5.1.5
resolution: "vite@npm:5.1.5"
dependencies:
esbuild: "npm:^0.19.3"
fsevents: "npm:~2.3.3"
postcss: "npm:^8.4.32"
postcss: "npm:^8.4.35"
rollup: "npm:^4.2.0"
peerDependencies:
"@types/node": ^18.0.0 || >=20.0.0
Expand Down Expand Up @@ -33275,7 +33235,7 @@ __metadata:
optional: true
bin:
vite: bin/vite.js
checksum: 10c0/c51b8e458851943c903fddde6973e720099ef8a5f364fb107cddade59c9e90f6d9ad98b61a7419cdfa0c6374236e10bff965d0c2d9e7b1790c68b874e5e7950c
checksum: 10c0/29be99ba0bec5e3ad50290510ba764b6c1016979a1ba70cf2071be9f1338f27e582a120836222e1fad6efb01c886a8fb57cb33471fadd0fceaa922bfc92bbbf7
languageName: node
linkType: hard

Expand Down