You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit c5dd02c
Browse filesBrowse the repository at this point in the historyBrowse files
Copy file name to clipboardExpand all lines: README.md
+6-5Lines changed: 6 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -24,7 +24,7 @@ yarn add -D solid-loader
24
24
bun add --dev solid-loader
25
25
```
26
26
27
-
Add `solid-loader` after `builtin:swc-loader` in the `use` array for JSX and TSX files. Rspack runs loaders from right to left, so Solid compiles the JSX first and SWC then strips TypeScript types.
27
+
Add `solid-loader` after `builtin:swc-loader` in the `use` array. Rspack runs loaders from right to left, so Solid compiles JSX first and SWC then strips TypeScript types. Plain JavaScript and TypeScript files pass directly to SWC.
28
28
29
29
```ts
30
30
// rspack.config.ts
@@ -38,7 +38,7 @@ export default defineConfig({
38
38
module: {
39
39
rules: [
40
40
{
41
-
test:/\.[mc]?[jt]sx$/i,
41
+
test:/\.[mc]?[jt]sx?$/i,
42
42
use: [
43
43
{
44
44
loader: 'builtin:swc-loader',
@@ -200,15 +200,16 @@ export default {
200
200
### scriptRegex
201
201
202
202
-**Type:**`RegExp`
203
+
-**Default:**`/\.[cm]?[jt]sx$/i`
203
204
204
-
Filter the files passed to the loader by filename. Without a filter, the loader processes every file matched by the Rspack rule. For example, a rule that handles TypeScript can restrict Solid compilation to TSX files.
205
+
The main loader compiles files whose names match this pattern. By default it matches JSX and TSX files, including their ESM and CommonJS variants. The following example also enables JSX in JavaScript files.
0 commit comments