{"id":18487,"library":"launch-editor-middleware","title":"launch-editor-middleware","description":"Express middleware that opens files in the user's default editor when requested via a URL. Version 2.13.2 is current; it is part of the launch-editor ecosystem by Evan You. It relies on launch-editor to resolve the editor and is typically used in development tooling like Vue CLI or Vite to open source files directly from the browser console. No active development fork, but stable and widely used. Differentiator: simple integration with Express, zero-config editor detection.","status":"active","version":"2.13.2","language":"javascript","source_language":"en","source_url":"https://github.com/yyx990803/launch-editor","tags":["javascript","express","middleware","editor"],"install":[{"cmd":"npm install launch-editor-middleware","lang":"bash","label":"npm"},{"cmd":"yarn add launch-editor-middleware","lang":"bash","label":"yarn"},{"cmd":"pnpm add launch-editor-middleware","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"core dependency for editor detection and launching","package":"launch-editor","optional":false},{"reason":"peer dependency; requires Express app instance","package":"express","optional":false}],"imports":[{"note":"ESM default export; CJS via require works with default export","wrong":"const launchEditorMiddleware = require('launch-editor-middleware')","symbol":"default","correct":"import launchEditorMiddleware from 'launch-editor-middleware'"},{"note":"CJS named export also available; prefer ESM when possible","wrong":"const launchEditorMiddleware = require('launch-editor-middleware').default","symbol":"launchEditorMiddleware","correct":"const { launchEditorMiddleware } = require('launch-editor-middleware')"}],"quickstart":{"code":"import express from 'express';\nimport launchEditorMiddleware from 'launch-editor-middleware';\n\nconst app = express();\napp.use('/__open-in-editor', launchEditorMiddleware());\napp.listen(3000, () => console.log('Server running on port 3000'));","lang":"typescript","description":"Shows how to mount the middleware on an Express app to open files via /__open-in-editor?file=path."},"warnings":[{"fix":"Call the function: `app.use('/__open-in-editor', launchEditorMiddleware())`.","message":"In version 2.x, the middleware signature changed from `app.use('/__open-in-editor', launchEditorMiddleware)` to `app.use('/__open-in-editor', launchEditorMiddleware())`.","severity":"breaking","affected_versions":">=2.0.0 <2.0.0"},{"fix":"Conditionally apply the middleware only when `NODE_ENV` is not `'production'`.","message":"The middleware only works in development environments; production builds should not include it.","severity":"gotcha","affected_versions":"all"},{"fix":"Use either import style consistently.","message":"The `default` import is the same as the named import; both are valid.","severity":"deprecated","affected_versions":"all"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"Run `npm install launch-editor-middleware --save-dev`.","cause":"Package not installed.","error":"Cannot find module 'launch-editor-middleware'"},{"fix":"Change `app.use('/__open-in-editor', launchEditorMiddleware)` to `app.use('/__open-in-editor', launchEditorMiddleware())`.","cause":"Missing function call parentheses.","error":"TypeError: launchEditorMiddleware is not a function"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}