File tree Expand file tree Collapse file tree 2 files changed +29
-2
lines changed
Expand file tree Collapse file tree 2 files changed +29
-2
lines changed Original file line number Diff line number Diff line change @@ -19,9 +19,9 @@ export default defineConfig({
1919
2020## Options
2121
22- ### include/exclude
22+ ### include
2323
24- Includes ` .js ` , ` .jsx ` , ` .ts ` & ` .tsx ` and excludes ` /node_modules/ ` by default. This option can be used to add fast refresh to ` .mdx ` files:
24+ Includes ` .js ` , ` .jsx ` , ` .ts ` & ` .tsx ` by default. This option can be used to add fast refresh to ` .mdx ` files:
2525
2626``` js
2727import { defineConfig } from ' vite'
@@ -36,6 +36,22 @@ export default defineConfig({
3636})
3737```
3838
39+ ### exclude
40+
41+ The default value is ` /node_modules/ ` . You may use it to exclude JSX/TSX files that runs in a worker or are not React files.
42+ Except if explicitly desired, you should keep ` node_modules ` in the exclude list:
43+
44+ ``` js
45+ import { defineConfig } from ' vite'
46+ import react from ' @vitejs/plugin-react'
47+
48+ export default defineConfig ({
49+ plugins: [
50+ react ({ exclude: [/ \/ pdf\/ / , / \. solid\. tsx$ / , / \/ node_modules\/ / ] }),
51+ ],
52+ })
53+ ```
54+
3955### jsxImportSource
4056
4157Control where the JSX factory is imported from. By default, this is inferred from ` jsxImportSource ` from corresponding a tsconfig file for a transformed file.
Original file line number Diff line number Diff line change @@ -32,7 +32,18 @@ async function loadBabel() {
3232}
3333
3434export interface Options {
35+ /**
36+ * Can be used to process extra files like `.mdx`
37+ * @example include: /\.(mdx|js|jsx|ts|tsx)$/
38+ * @default /\.[tj]sx?$/
39+ */
3540 include ?: string | RegExp | Array < string | RegExp >
41+ /**
42+ * Can be used to exclude JSX/TSX files that runs in a worker or are not React files.
43+ * Except if explicitly desired, you should keep node_modules in the exclude list
44+ * @example exclude: [/\/pdf\//, /\.solid\.tsx$/, /\/node_modules\//]
45+ * @default /\/node_modules\//
46+ */
3647 exclude ?: string | RegExp | Array < string | RegExp >
3748 /**
3849 * Control where the JSX factory is imported from.
You can’t perform that action at this time.
0 commit comments