webfansplz / vite-plugin-vue-inspector

jump to editor source code while click the element of browser automatically.
MIT License
697 stars 74 forks source link

Doesn't work if Vite has a base configured #53

Closed ben closed 1 year ago

ben commented 1 year ago

My project runs in dev mode against Foundry VTT, and Vite's base is configured as /systems/foundry-ironsworn/. This works when the Vite app isn't serving the whole app, only parts of it.

But when I try to use the inspector, the URL it tries to visit looks like this:

http://localhost:8080/__open-in-editor?file=src/...

That doesn't work, because that path gets proxied to the underlying app. If I visit this URL directly:

http://localhost:8080/systems/foundry-ironsworn/__open-in-editor?file=src/...

Then it works properly. Looks like this plugin needs to include Vite's base configuration in this place in the code.

webfansplz commented 1 year ago

I can't reproduce it, can you provide a mini repo ? Thanks !

mishengqiang commented 7 months ago

@webfansplz 作者你好,我看create vue现在创建项目时可以选择使用这个插件了,以后使用量会越来越大。关于配置base后在编辑器打开失败的问题,直接使用openInEditorHost配置解决感觉有点简单粗暴。关键在于无法达到开箱即用的效果。是否可以通过代码逻辑在插件内部解决配置base后在编辑器中打不开的问题呢?

webfansplz commented 7 months ago

@webfansplz 作者你好,我看create vue现在创建项目时可以选择使用这个插件了,以后使用量会越来越大。关于配置base后在编辑器打开失败的问题,直接使用openInEditorHost配置解决感觉有点简单粗暴。关键在于无法达到开箱即用的效果。是否可以通过代码逻辑在插件内部解决配置base后在编辑器中打不开的问题呢?

你好,提供 openInEditorHost 配置的原因是在于用户的开发环境和代理手段是多样的,比如 (Nginx、Laravel + Vue),这在插件内部是无法消化和处理的。另外如果用户只是调整了 Vite 的 base 配置没做其他代理,目前无需配置 openInEditorHost 应该是可以正常工作的。