Skip to content

Commit b5c7ccd

Browse files
committed
fix build in Bun v1.2.22
1 parent cddf6ed commit b5c7ccd

File tree

3 files changed

+9
-31
lines changed

3 files changed

+9
-31
lines changed

build.ts

Lines changed: 1 addition & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
11
import { Glob, Transpiler, fileURLToPath, pathToFileURL } from "bun";
22
import { basename, join, parse, relative } from "node:path";
33

4-
function escapeRegExp(string: string) {
5-
return string.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"); // $& means the whole matched string
6-
}
7-
84
export async function build({
95
baseDir,
106
buildDir = ".build",
@@ -62,26 +58,8 @@ export async function build({
6258
name: "bun-react-ssr",
6359
target: "browser",
6460
setup(build) {
65-
build.onLoad(
66-
{
67-
filter: new RegExp(
68-
"^" + escapeRegExp(absPageDir) + "/.*" + "\\.ts[x]$"
69-
),
70-
},
71-
async ({ path, loader }) => {
72-
const search = new URLSearchParams();
73-
search.append("client", "1");
74-
search.append("loader", loader);
75-
return {
76-
contents:
77-
"export { default } from " +
78-
JSON.stringify("./" + basename(path) + "?client"),
79-
loader: "ts",
80-
};
81-
}
82-
);
8361
build.onResolve(
84-
{ filter: /\.ts[x]\?client$/ },
62+
{ filter: new RegExp(`^${RegExp.escape(absPageDir)}/.*\\.ts[x]$`) },
8563
async ({ importer, path }) => {
8664
const url = pathToFileURL(importer);
8765
return {

bun.lockb

-333 Bytes
Binary file not shown.

package.json

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,18 +14,18 @@
1414
"license": "MIT",
1515
"type": "module",
1616
"devDependencies": {
17-
"typescript": "^5.7.2",
18-
"@types/bun": "^1.1.14",
19-
"@types/react": "^18.3.12",
20-
"@types/react-dom": "^18.3.1",
21-
"bun-plugin-dts": "^0.2.4"
17+
"typescript": "^5.9.2",
18+
"@types/bun": "^1.2.23",
19+
"@types/react": "^19.1.16",
20+
"@types/react-dom": "^19.1.9",
21+
"bun-plugin-dts": "^0.3.0"
2222
},
2323
"peerDependencies": {
24-
"react": "19.0.0-rc-1eaccd82-20240816",
25-
"react-dom": "19.0.0-rc-1eaccd82-20240816"
24+
"react": "19.1.1",
25+
"react-dom": "19.1.1"
2626
},
2727
"dependencies": {
28-
"next-json": "^0.3.2"
28+
"next-json": "^0.5.0"
2929
},
3030
"scripts": {
3131
"dist": "bun run scripts/dist.ts"

0 commit comments

Comments
 (0)