Skip to content

Commit 22f121a

Browse files
committed
chore: merge main
2 parents 1c4f8b9 + fc9302b commit 22f121a

File tree

3 files changed

+53
-7
lines changed

3 files changed

+53
-7
lines changed
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: Preview Publish
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
types: [opened, synchronize, labeled]
9+
10+
permissions: {}
11+
12+
jobs:
13+
preview:
14+
if: >
15+
github.repository == 'vitejs/vite-plugin-react' &&
16+
(github.event_name == 'push' ||
17+
(github.event_name == 'pull_request' && contains(github.event.pull_request.labels.*.name, 'trigger: preview')))
18+
runs-on: ubuntu-latest
19+
steps:
20+
- name: Checkout code
21+
uses: actions/checkout@v4
22+
23+
- name: Install pnpm
24+
uses: pnpm/action-setup@a7487c7e89a18df4991f7f222e4898a00d66ddda # v4.1.0
25+
26+
- uses: actions/setup-node@v4
27+
with:
28+
node-version: lts/*
29+
cache: pnpm
30+
31+
- name: Install dependencies
32+
run: pnpm install
33+
34+
- name: Build
35+
run: pnpm build
36+
37+
- name: Publish
38+
run: pnpm dlx [email protected] publish --pnpm --compact './packages/*' './packages/plugin-react-swc/dist'

packages/plugin-react-swc/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@
66

77
Added `filter` so that it is more performant when running this plugin with rolldown-powered version of Vite.
88

9+
### Skip HMR preamble in Vitest browser mode
10+
11+
This was causing annoying `Sourcemap for "/@react-refresh" points to missing source files` and is unnecessary in test mode.
12+
913
## 3.9.0 (2025-04-15)
1014

1115
### Make compatible with rolldown-vite

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

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -142,13 +142,17 @@ const react = (_options?: Options): PluginOption[] => {
142142
)
143143
}
144144
},
145-
transformIndexHtml: (_, config) => [
146-
{
147-
tag: 'script',
148-
attrs: { type: 'module' },
149-
children: getPreambleCode(config.server!.config.base),
150-
},
151-
],
145+
transformIndexHtml: (_, config) => {
146+
if (!hmrDisabled) {
147+
return [
148+
{
149+
tag: 'script',
150+
attrs: { type: 'module' },
151+
children: getPreambleCode(config.server!.config.base),
152+
},
153+
]
154+
}
155+
},
152156
async transform(code, _id, transformOptions) {
153157
const id = _id.split('?')[0]
154158
const refresh = !transformOptions?.ssr && !hmrDisabled

0 commit comments

Comments
 (0)