File tree Expand file tree Collapse file tree 1 file changed +17
-2
lines changed Expand file tree Collapse file tree 1 file changed +17
-2
lines changed Original file line number Diff line number Diff line change 1
1
import { resolve } from 'node:path' ;
2
- import type { UserConfig } from 'vite' ;
2
+ import type { Plugin , UserConfig } from 'vite' ;
3
3
import tsconfigPaths from 'vite-tsconfig-paths' ;
4
4
import react from '@vitejs/plugin-react' ;
5
5
6
6
const __dirname = new URL ( '.' , import . meta. url ) . pathname ;
7
7
8
+ // Add react-scan in local development mode
9
+ const reactScanPlugin : Plugin = {
10
+ name : 'react-scan' ,
11
+ transformIndexHtml ( html , ctx ) {
12
+ if ( ctx . server ?. config . command === 'serve' ) {
13
+ return html . replace (
14
+ '<head>' ,
15
+ '<head><script src="https://unpkg.com/react-scan/dist/auto.global.js"></script>' ,
16
+ ) ;
17
+ }
18
+
19
+ return html ;
20
+ } ,
21
+ } ;
22
+
8
23
export default {
9
24
root : __dirname ,
10
- plugins : [ tsconfigPaths ( ) , react ( ) ] ,
25
+ plugins : [ tsconfigPaths ( ) , react ( ) , reactScanPlugin ] ,
11
26
build : {
12
27
rollupOptions : {
13
28
input : {
You can’t perform that action at this time.
0 commit comments