Skip to content

Commit c2fc9a3

Browse files
Copilothi-ogawa
andcommitted
Make regex patterns more explicit for better readability
Change tsx? to (tsx|ts) to make it clearer that both extensions are matched Co-authored-by: hi-ogawa <[email protected]>
1 parent ebcc684 commit c2fc9a3

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ const react = (_options?: Options): Plugin[] => {
202202
}
203203
: {
204204
// Add filter for default extensions: .tsx, .ts, .mts, .jsx, .mdx
205-
filter: { id: /\.(tsx?|mts|jsx|mdx)(?:$|\?)/ },
205+
filter: { id: /\.(tsx|ts|mts|jsx|mdx)(?:$|\?)/ },
206206
async handler(code, _id, transformOptions) {
207207
const id = _id.split('?')[0]
208208
const refresh = !transformOptions?.ssr && !hmrDisabled
@@ -261,7 +261,7 @@ const react = (_options?: Options): Plugin[] => {
261261
)
262262
: {
263263
// Add filter for default extensions: .tsx, .ts, .mts, .jsx, .mdx
264-
filter: { id: /\.(tsx?|mts|jsx|mdx)(?:$|\?)/ },
264+
filter: { id: /\.(tsx|ts|mts|jsx|mdx)(?:$|\?)/ },
265265
handler: (code, _id) =>
266266
transformWithOptions(
267267
_id.split('?')[0],

0 commit comments

Comments
 (0)