Skip to content

Commit 363f57d

Browse files
chore(swc): apply suggestions from code review
Co-authored-by: Kamil Mysliwiec <[email protected]>
1 parent d17985d commit 363f57d

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

content/recipes/swc.md

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -121,13 +121,12 @@ export default defineConfig({
121121
globals: true,
122122
root: './',
123123
},
124-
125124
plugins: [swc.vite()], // This is required to build the test files with SWC
126125
});
127126
```
128127

129-
This configuration file sets up the Vitest environment with the necessary aliases, root directory, and SWC plugin. You should also create a separate configuration
130-
file for e2e tests, with an additional field `include` that specifies the test path regex:
128+
This configuration file sets up the Vitest environment, root directory, and SWC plugin. You should also create a separate configuration
129+
file for e2e tests, with an additional `include` field that specifies the test path regex:
131130

132131
```ts
133132
import swc from 'unplugin-swc';
@@ -143,7 +142,7 @@ export default defineConfig({
143142
});
144143
```
145144

146-
Additionaly, you can set the `alias` options to support typescript paths in your tests:
145+
Additionally, you can set the `alias` options to support TypeScript paths in your tests:
147146

148147
```ts
149148
import swc from 'unplugin-swc';
@@ -171,7 +170,7 @@ export default defineConfig({
171170

172171
#### Update imports in E2E tests
173172

174-
Change any E2E test imports using `import * as request from 'supertest'` to `import request from 'supertest';`. This is necessary because Vitest, when bundled with Vite, expects a default import for supertest. Using a namespace import may cause issues in this specific setup.
173+
Change any E2E test imports using `import * as request from 'supertest'` to `import request from 'supertest'`. This is necessary because Vitest, when bundled with Vite, expects a default import for supertest. Using a namespace import may cause issues in this specific setup.
175174

176175
Lastly, update the test scripts in your package.json file to the following:
177176

0 commit comments

Comments
 (0)