File tree Expand file tree Collapse file tree 2 files changed +11
-5
lines changed
Expand file tree Collapse file tree 2 files changed +11
-5
lines changed Original file line number Diff line number Diff line change 1+ ---
2+ " solid-devtools " : patch
3+ ---
4+
5+ Use ` apply ` to conditionally disable the vite plugin.
Original file line number Diff line number Diff line change @@ -67,22 +67,23 @@ export const devtoolsPlugin = (_options: DevtoolsPluginOptions = {}): vite.Plugi
6767 }
6868 : null
6969
70- let is_dev = false
7170 let project_root = process . cwd ( )
7271
7372 return {
7473 name : 'solid-devtools' ,
7574 enforce : 'pre' ,
7675 configResolved ( config ) {
7776 project_root = config . root
78- is_dev = config . command === 'serve' && config . mode !== 'production'
77+ } ,
78+ apply ( config , env ) {
79+ return env . command === 'serve' && env . mode !== 'production'
7980 } ,
8081 resolveId ( id ) {
81- if ( is_dev && id === DevtoolsModule . Main ) return DevtoolsModule . Main
82+ if ( id === DevtoolsModule . Main ) return DevtoolsModule . Main
8283 } ,
8384 load ( id ) {
8485 // Inject runtime debugger script
85- if ( ! is_dev || id !== DevtoolsModule . Main ) return
86+ if ( id !== DevtoolsModule . Main ) return
8687
8788 let code = `import "${ DevtoolsModule . Setup } ";`
8889
@@ -96,7 +97,7 @@ export const devtoolsPlugin = (_options: DevtoolsPluginOptions = {}): vite.Plugi
9697 async transform ( source , id , transformOptions ) {
9798
9899 // production and server should be disabled
99- if ( transformOptions ?. ssr || ! is_dev ) return
100+ if ( transformOptions ?. ssr ) return
100101
101102 const extname = get_extname ( id )
102103
You can’t perform that action at this time.
0 commit comments