File tree Expand file tree Collapse file tree 2 files changed +3
-8
lines changed Expand file tree Collapse file tree 2 files changed +3
-8
lines changed Original file line number Diff line number Diff line change @@ -15,18 +15,13 @@ function nameFromDeclaration(node?: VariableDeclarator) {
1515 return node ?. id . type === 'Identifier' && node . id . name
1616}
1717
18- export function autoRegisterHMRPlugin (
19- nuxt : Nuxt ,
20- { resolve } : { resolve : ( ...path : string [ ] ) => string }
21- ) {
22- const projectBasePath = resolve ( nuxt . options . rootDir )
23-
18+ export function autoRegisterHMRPlugin ( rootDir : string ) {
2419 return {
2520 name : 'pinia:auto-hmr-registration' ,
2621
2722 transform ( code , id ) {
2823 if ( id . startsWith ( '\x00' ) ) return
29- if ( ! id . startsWith ( projectBasePath ) ) return
24+ if ( ! id . startsWith ( rootDir ) ) return
3025 if ( ! code . includes ( 'defineStore' ) || code . includes ( 'acceptHMRUpdate' ) ) {
3126 return
3227 }
Original file line number Diff line number Diff line change @@ -87,7 +87,7 @@ const module: NuxtModule<ModuleOptions> = defineNuxtModule<ModuleOptions>({
8787
8888 // Register automatic hmr code plugin - dev mode only
8989 if ( nuxt . options . dev ) {
90- addVitePlugin ( autoRegisterHMRPlugin ( nuxt , { resolve } ) )
90+ addVitePlugin ( autoRegisterHMRPlugin ( resolve ( nuxt . options . rootDir ) ) )
9191 }
9292 } ,
9393} )
You can’t perform that action at this time.
0 commit comments