Skip to content

Commit 22be17f

Browse files
authored
build: use tsdown for plugin-react / plugin-react-oxc (#554)
1 parent 84dfff7 commit 22be17f

File tree

16 files changed

+61
-154
lines changed

16 files changed

+61
-154
lines changed

packages/plugin-react-oxc/build.config.ts

Lines changed: 0 additions & 14 deletions
This file was deleted.

packages/plugin-react-oxc/package.json

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,11 @@
2020
"dist"
2121
],
2222
"type": "module",
23-
"types": "./dist/index.d.mts",
24-
"exports": "./dist/index.mjs",
23+
"types": "./dist/index.d.ts",
24+
"exports": "./dist/index.js",
2525
"scripts": {
26-
"dev": "unbuild --stub",
27-
"build": "unbuild && tsx scripts/copyRefreshRuntime.ts",
26+
"dev": "tsdown --watch",
27+
"build": "tsdown",
2828
"prepublishOnly": "npm run build"
2929
},
3030
"engines": {
@@ -44,6 +44,7 @@
4444
},
4545
"devDependencies": {
4646
"@vitejs/react-common": "workspace:*",
47+
"tsdown": "^0.12.9",
4748
"unbuild": "^3.5.0",
4849
"vite": "catalog:rolldown-vite"
4950
},

packages/plugin-react-oxc/scripts/copyRefreshRuntime.ts

Lines changed: 0 additions & 6 deletions
This file was deleted.

packages/plugin-react-oxc/src/build.d.ts

Lines changed: 0 additions & 7 deletions
This file was deleted.

packages/plugin-react-oxc/src/index.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,7 @@ import {
1212
import { exactRegex } from '@rolldown/pluginutils'
1313

1414
const _dirname = dirname(fileURLToPath(import.meta.url))
15-
16-
const refreshRuntimePath = globalThis.__IS_BUILD__
17-
? join(_dirname, 'refresh-runtime.js')
18-
: // eslint-disable-next-line n/no-unsupported-features/node-builtins -- only used in dev
19-
fileURLToPath(import.meta.resolve('@vitejs/react-common/refresh-runtime'))
15+
const refreshRuntimePath = join(_dirname, 'refresh-runtime.js')
2016

2117
export interface Options {
2218
include?: string | RegExp | Array<string | RegExp>

packages/plugin-react-oxc/tsconfig.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"include": ["src", "scripts"],
2+
"include": ["src"],
33
"compilerOptions": {
44
"outDir": "dist",
55
"target": "ES2020",
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import { defineConfig } from 'tsdown'
2+
3+
export default defineConfig({
4+
entry: 'src/index.ts',
5+
copy: [
6+
{
7+
from: 'node_modules/@vitejs/react-common/refresh-runtime.js',
8+
to: 'dist/refresh-runtime.js',
9+
},
10+
],
11+
})

packages/plugin-react/build.config.ts

Lines changed: 0 additions & 15 deletions
This file was deleted.

packages/plugin-react/package.json

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,18 +21,17 @@
2121
],
2222
"type": "module",
2323
"main": "./dist/index.cjs",
24-
"module": "./dist/index.mjs",
25-
"types": "./dist/index.d.mts",
24+
"module": "./dist/index.js",
25+
"types": "./dist/index.d.ts",
2626
"exports": {
2727
".": {
28-
"import": "./dist/index.mjs",
28+
"import": "./dist/index.js",
2929
"require": "./dist/index.cjs"
3030
}
3131
},
3232
"scripts": {
33-
"dev": "unbuild --stub",
34-
"build": "unbuild && pnpm run patch-cjs && tsx scripts/copyRefreshRuntime.ts",
35-
"patch-cjs": "tsx ../../scripts/patchCJS.ts",
33+
"dev": "tsdown --watch",
34+
"build": "tsdown",
3635
"prepublishOnly": "npm run build",
3736
"test-unit": "vitest run"
3837
},
@@ -65,7 +64,7 @@
6564
"react": "^19.1.0",
6665
"react-dom": "^19.1.0",
6766
"rolldown": "1.0.0-beta.24",
68-
"unbuild": "^3.5.0",
67+
"tsdown": "^0.12.9",
6968
"vitest": "^3.2.4"
7069
}
7170
}

packages/plugin-react/scripts/copyRefreshRuntime.ts

Lines changed: 0 additions & 6 deletions
This file was deleted.

0 commit comments

Comments
 (0)