Skip to content

Commit 2e1fd8c

Browse files
committed
improve inspector plugin
1 parent 3ba9fec commit 2e1fd8c

File tree

1 file changed

+7
-7
lines changed
  • packages/vite-plugin-svelte-inspector/src

1 file changed

+7
-7
lines changed

packages/vite-plugin-svelte-inspector/src/index.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ export function svelteInspector(options) {
3434
enforce: 'pre',
3535

3636
applyToEnvironment(env) {
37-
return env.config.consumer === 'client';
37+
return !disabled && env.config.consumer === 'client';
3838
},
3939

4040
configResolved(config) {
@@ -77,14 +77,14 @@ export function svelteInspector(options) {
7777
filter: {
7878
id: /^virtual:svelte-inspector-/
7979
},
80-
async handler(importee, _, options) {
81-
if (options?.ssr || disabled) {
80+
async handler(id) {
81+
if (disabled) {
8282
return;
8383
}
84-
if (importee.startsWith('virtual:svelte-inspector-options')) {
85-
return importee;
86-
} else if (importee.startsWith('virtual:svelte-inspector-path:')) {
87-
return importee.replace('virtual:svelte-inspector-path:', inspectorPath);
84+
if (id === 'virtual:svelte-inspector-options') {
85+
return id;
86+
} else if (id.startsWith('virtual:svelte-inspector-path:')) {
87+
return id.replace('virtual:svelte-inspector-path:', inspectorPath);
8888
}
8989
}
9090
},

0 commit comments

Comments
 (0)