{"id":26973,"library":"f2e-server","title":"f2e-server","description":"f2e-server 2 (v2.20.13) is a front-end development server with built-in support for Less compilation, Babel transpilation, live reload, and middleware-based plugin architecture. It provides CLI commands for starting a dev server (`f2e start`), building to output (`f2e build`), and generating config files (`f2e conf`). Unlike heavyweight dev servers like webpack-dev-server, f2e-server focuses on simplicity and runtime-build with proxy capabilities. It ships with TypeScript type definitions but is primarily configured via CommonJS config files. The project has been updated infrequently (last release likely 2021-2022) and may lack modern features like HMR or ESM native support. The server auto-detects ports starting from 2850 and supports HTTPS and custom hostnames. It is suitable for lightweight front-end projects that need a quick development environment with minimal configuration.","status":"maintenance","version":"2.20.13","language":"javascript","source_language":"en","source_url":"https://github.com/shy2850/f2e-server","tags":["javascript","f2e","f2e-server","proxy","debug","runtime-build","typescript"],"install":[{"cmd":"npm install f2e-server","lang":"bash","label":"npm"},{"cmd":"yarn add f2e-server","lang":"bash","label":"yarn"},{"cmd":"pnpm add f2e-server","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Used in default config example for proxy requests; deprecated but still usable.","package":"request","optional":true},{"reason":"Used in example middleware for Markdown compilation; not a hard dependency but commonly used.","package":"marked","optional":true}],"imports":[{"note":"CLI is invoked via 'f2e' command, not npm scripts. Install globally or use npx.","wrong":"npm start","symbol":"f2e server (CLI)","correct":"npx f2e start"},{"note":"Config is CommonJS, not ESM. Use module.exports.","wrong":"export default { ... }","symbol":"Default config export","correct":"module.exports = { ... }"},{"note":"Middleware must return an object with lifecycle hooks. Forgetting the return object breaks server.","wrong":"function middleware(conf) { } // missing return object","symbol":"Middleware function","correct":"(conf) => { return { onRoute, onSet, ... }; }"},{"note":"Each rule requires 'getModuleId' function. Without it, rule may be ignored.","wrong":"useBabel: { _rules: [ { only: ['file.js'] } ] } // missing getModuleId","symbol":"babel _rules","correct":"useBabel: { _rules: [ { only: ['file.js'], getModuleId: ... } ] }"}],"quickstart":{"code":"// .f2econfig.js\nconst path = require('path');\nmodule.exports = {\n  livereload: true,\n  useLess: { compress: false },\n  useBabel: { getModuleId: p => p.replace(/\\\\+/g, '/') },\n  gzip: true,\n  range_size: 1024 * 1024,\n  middlewares: [\n    (conf) => {\n      return {\n        onRoute(pathname, req, resp, memory) {\n          if (pathname.match(/^es6/)) {\n            const request = require('request');\n            request(pathname.replace('es6', 'http://es6.ruanyifeng.com')).pipe(resp);\n            return false;\n          }\n        },\n        onSet(pathname, data, store) {\n          if (pathname.match(/\\.md$/)) {\n            const res = require('marked')(data.toString());\n            store._set(pathname.replace(/\\.md$/, '.html'), res);\n          }\n        },\n        buildWatcher(eventType, pathname, build) {\n          console.log(new Date().toLocaleString(), eventType, pathname);\n        }\n      };\n    }\n  ]\n}","lang":"javascript","description":"Basic f2e-server configuration file with live reload, Less, Babel, and a middleware that proxies ES6 routes and compiles Markdown to HTML."},"warnings":[{"fix":"Update middleware to return an object and use conf parameter.","message":"f2e-server v2.x configuration is not compatible with v1.x. Middleware signature changed from (req, resp) to (conf).","severity":"breaking","affected_versions":">=2.0.0 <2.0.0"},{"fix":"Replace with 'node-fetch' or 'axios' in your middleware.","message":"The 'request' package used in examples is deprecated and will not receive security updates.","severity":"deprecated","affected_versions":">=0.0.0"},{"fix":"Always return false from onRoute if you are handling the response yourself.","message":"If you omit 'return false' from onRoute, the request will continue to other middlewares and may cause double response.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Set 'no_host: true' if you want to ignore host header and serve all requests.","message":"The 'no_host' option is set to false by default. If you set a host in the config, requests that don't match the host header will be ignored.","severity":"gotcha","affected_versions":">=0.0.0"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"Start with a specific port: f2e start -p 2851","cause":"Port 2850 already in use.","error":"Error: listen EADDRINUSE :::2850"},{"fix":"Install marked: npm install marked --save-dev","cause":"Marked is not installed but used in middleware.","error":"Cannot find module 'marked'"},{"fix":"Use store._set only inside onSet handler.","cause":"Using store._set outside of onSet hook; store is only available in onSet.","error":"TypeError: store._set is not a function"},{"fix":"Install globally: npm install -g f2e-server","cause":"f2e-server is not installed globally or not in PATH.","error":"f2e: command not found"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}