Skip to content

Commit

Permalink
feat: upgrade to vite 4.5.0 (#141)
Browse files Browse the repository at this point in the history
* chore: bump vite version

* chore: remove unused package `json`

* chore: remove unused `postinstall` script

* fix: code

---------

Co-authored-by: Daishi Kato <dai-shi@users.noreply.github.com>
  • Loading branch information
himself65 and dai-shi authored Oct 25, 2023
1 parent 39aadeb commit c2b3df2
Show file tree
Hide file tree
Showing 7 changed files with 28 additions and 68 deletions.
5 changes: 0 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,5 @@
"react-server-dom-webpack": "18.3.0-canary-a41957507-20231017",
"typescript": "^5.2.2",
"waku": "workspace:*"
},
"pnpm": {
"patchedDependencies": {
"vite@4.4.10": "packages/waku/patches/vite@4.4.10.patch"
}
}
}
3 changes: 1 addition & 2 deletions packages/create-waku/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"scripts": {
"start": "node dist/cli.js",
"compile": "rm -rf template dist && pnpm run template && pnpm run build",
"template": "cp -r ../../examples template/; for d in template/*; do cp -r ../waku/patches $d; json -I -f $d/package.json -e 'this.pnpm??={};this.pnpm.patchedDependencies??={};this.pnpm.patchedDependencies[\"vite@4.4.10\"]=\"patches/vite@4.4.10.patch\"'; done",
"template": "cp -r ../../examples template/",
"build": "esbuild src/* --bundle --platform=node --outdir=dist"
},
"dependencies": {
Expand All @@ -30,7 +30,6 @@
"devDependencies": {
"@types/fs-extra": "^11.0.2",
"@types/prompts": "^2.4.5",
"json": "^11.0.0",
"esbuild": "0.19.4"
}
}
5 changes: 2 additions & 3 deletions packages/waku/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,7 @@
"dev": "swc src -d dist -w",
"compile": "rm -rf dist && pnpm run compile:code && pnpm run compile:types",
"compile:code": "swc src -d dist && swc src -d dist/cjs -C module.type=commonjs && echo '{\"type\":\"commonjs\"}' > dist/cjs/package.json",
"compile:types": "tsc --project tsconfig.json",
"postinstall": "(cd node_modules/vite && patch -p1 -i ../../patches/vite@4.4.10.patch) || (cd ../vite && patch -p1 -i ../waku/patches/vite@4.4.10.patch) || true"
"compile:types": "tsc --project tsconfig.json"
},
"license": "MIT",
"engines": {
Expand All @@ -69,7 +68,7 @@
"@swc/core": "1.3.91",
"@vitejs/plugin-react": "^4.1.0",
"busboy": "^1.6.0",
"vite": "4.4.10"
"vite": "4.5.0"
},
"devDependencies": {
"@swc/cli": "^0.1.62",
Expand Down
19 changes: 0 additions & 19 deletions packages/waku/patches/vite@4.4.10.patch

This file was deleted.

12 changes: 6 additions & 6 deletions packages/waku/src/lib/builder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,11 @@ const analyzeEntries = async (entriesFile: string) => {
),
],
ssr: {
resolve: {
externalConditions: ["react-server"],
},
noExternal: /^(?!node:)/,
},
resolve: {
conditions: ["react-server"],
},
build: {
write: false,
ssr: true,
Expand Down Expand Up @@ -103,6 +103,9 @@ const buildServerBundle = async (
const serverBuildOutput = await viteBuild({
...configFileConfig(),
ssr: {
resolve: {
externalConditions: ["react-server"],
},
noExternal: Object.values(clientEntryFiles).map(
// FIXME this might not work with pnpm
(fname) =>
Expand All @@ -111,9 +114,6 @@ const buildServerBundle = async (
.split("/")[0]!,
),
},
resolve: {
conditions: ["react-server"],
},
publicDir: false,
build: {
ssr: true,
Expand Down
6 changes: 4 additions & 2 deletions packages/waku/src/lib/middleware/rsc/worker-impl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -140,8 +140,10 @@ const getViteServer = async (command: "dev" | "build" | "start") => {
parentPort!.postMessage(mesg);
}),
],
resolve: {
conditions: ["react-server"],
ssr: {
resolve: {
externalConditions: ["react-server"],
},
},
appType: "custom",
server: { middlewareMode: true, hmr: { server: dummyServer } },
Expand Down
46 changes: 15 additions & 31 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 comment on commit c2b3df2

@vercel
Copy link

@vercel vercel bot commented on c2b3df2 Oct 25, 2023

Choose a reason for hiding this comment

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

Successfully deployed to the following URLs:

waku – ./

waku.vercel.app
www.waku.gg
waku-daishi.vercel.app
waku-git-main-daishi.vercel.app
waku.gg

Please sign in to comment.