Skip to content

Open in Editor dosent work when Options API disabled #824

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
3 tasks
joshkrz opened this issue Mar 11, 2025 · 2 comments
Open
3 tasks

Open in Editor dosent work when Options API disabled #824

joshkrz opened this issue Mar 11, 2025 · 2 comments
Labels
bug Something isn't working pr welcome

Comments

@joshkrz
Copy link

joshkrz commented Mar 11, 2025

Issue

When the Options API is disabled in the @vitejs/plugin-vue plugin options, devtools cannot open any files in my editor of choice. The browser console outputs the following errors:

Firefox 136.0

TypeError: (intermediate value).__VUE_INSPECTOR__ is undefined

Chrome 134.0

TypeError: Cannot read properties of undefined (reading 'openInEditor')

Steps to Reproduce

  • Disable the options API in the @vitejs/plugin-vue configuration options
  • Run the development sever
  • Open the devtools, select a Vue component and try and "Open in Editor"

Environment

Versions

  • vue 3.5.13
  • vite 6.2.1
  • vite-plugin-vue-devtools 7.7.2
  • vite-plugin-symfony: 8.0.2,
  • @tailwindcss/vite 4.0.12

Vite Config

// vite.config.js

import { defineConfig } from 'vite';
import symfonyPlugin from 'vite-plugin-symfony';
import vue from '@vitejs/plugin-vue';
import vueDevTools from 'vite-plugin-vue-devtools';
import { fileURLToPath, URL } from 'node:url';
import tailwindcss from '@tailwindcss/vite';

import * as fs from 'node:fs';
import dotenv from 'dotenv';

dotenv.config({ path: `.env.local` });
const launchEditor = process.env?.CODE_EDITOR;
const viteHost = process.env.FRONTEND_VITE_HOST;
const host = process.env.FRONTEND_HOST;

export default defineConfig({
  plugins: [
    vue({
      features: {
        optionsAPI: false,
      },
    }),
    vueDevTools({
      launchEditor: launchEditor,
      appendTo: 'assets/app.js',
    }),
    symfonyPlugin({
      viteDevServerHostname: viteHost,
    }),
    tailwindcss(),
  ],
  resolve: {
    alias: {
      '@': fileURLToPath(new URL('./assets', import.meta.url)),
    },
  },
  server: {
    host: viteHost,
    https: {
      key: fs.readFileSync(`${viteHost}-key.pem`),
      cert: fs.readFileSync(`${viteHost}.pem`),
    },
    cors: host,
  },
  build: {
    rollupOptions: {
      input: {
        app: './assets/app.js',
      },
    },
  },
});

Solution

Don't disable the options API in the configuration options.

- vue({
-     features: {
-       optionsAPI: false,
-     },
-   }),

+ vue(),
@alexzhang1030 alexzhang1030 added bug Something isn't working pr welcome labels Mar 12, 2025
@kevinluo201
Copy link
Contributor

kevinluo201 commented Mar 26, 2025

I think the reason behind this is the library to open the file in the editor, vite-plugin-vue-inspector, is still using option api. There is an issue for that webfansplz/vite-plugin-vue-inspector#122. I think it's not related to devtool directly.

@devtobi
Copy link

devtobi commented Apr 16, 2025

This is also related to: #711

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working pr welcome
Projects
None yet
Development

No branches or pull requests

4 participants