Skip to content
This repository was archived by the owner on Jul 24, 2025. It is now read-only.

Commit 10db2d5

Browse files
authored
feat: vitest deps.experimentalOptimizer (fixes #111) (#115)
1 parent 8e311c0 commit 10db2d5

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
## Unreleased
44

5+
- Support [Vitest deps.experimentalOptimizer](https://vitest.dev/config/#deps-experimentaloptimizer)
6+
57
## 3.3.1
68

79
- Add `type: module` to package.json ([#101](https://github.com/vitejs/vite-plugin-react-swc/pull/101)). Because the library already publish `.cjs` & `.mjs` files, the only change is for typing when using the node16 module resolution (fixes [#95](https://github.com/vitejs/vite-plugin-react-swc/issues/95))

src/index.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,16 +101,17 @@ const react = (_options?: Options): PluginOption[] => {
101101
],
102102
async transform(code, _id, transformOptions) {
103103
const id = _id.split("?")[0];
104+
const refresh = !transformOptions?.ssr && !process.env.TEST;
104105

105106
const result = await transformWithOptions(id, code, "es2020", options, {
106-
refresh: !transformOptions?.ssr,
107+
refresh,
107108
development: true,
108109
runtime: "automatic",
109110
importSource: options.jsxImportSource,
110111
});
111112
if (!result) return;
112113

113-
if (transformOptions?.ssr || !refreshContentRE.test(result.code)) {
114+
if (!refresh || !refreshContentRE.test(result.code)) {
114115
return result;
115116
}
116117

0 commit comments

Comments
 (0)