perf(nuxt): use filter for vfs plugin load · nuxt/nuxt@eb3d2d4

File tree

1 file changed

lines changed

  • packages/nuxt/src/core/plugins

1 file changed

lines changed

Original file line numberDiff line numberDiff line change

@@ -78,16 +78,17 @@ export const VirtualFSPlugin = (nuxt: Nuxt, options: VirtualFSPluginOptions) =>

7878

},

7979

},

8080
81-

loadInclude (id) {

82-

return PREFIX_RE.test(id) && withoutQuery(withoutPrefix(decodeURIComponent(id))) in nuxt.vfs

83-

},

84-
85-

load (id) {

86-

const key = withoutQuery(withoutPrefix(decodeURIComponent(id)))

87-

return {

88-

code: nuxt.vfs[key] || '',

89-

map: null,

90-

}

81+

load: {

82+

filter: {

83+

id: PREFIX_RE,

84+

},

85+

handler (id) {

86+

const key = withoutQuery(withoutPrefix(decodeURIComponent(id)))

87+

return {

88+

code: nuxt.vfs[key] || '',

89+

map: null,

90+

}

91+

},

9192

},

9293

}

9394

})