{"library":"egg-static","type":"library","category":null,"description":"`egg-static` is a core plugin for the Egg.js Node.js framework, providing robust static file serving capabilities. It is built upon `koa-static-cache`, inheriting its efficient caching and serving mechanisms. The plugin is usually enabled by default in Egg.js applications, simplifying the process of making static assets available. Currently, the `2.x` series is stable, with `v2.3.1` released in February 2023. A significant `v3.0.0` release in January 2025 introduced breaking changes, primarily dropping support for older Node.js versions (below 18.19.0). Its release cadence is generally tied to the Egg.js framework's development. Key differentiators include its seamless integration with the Egg.js ecosystem, intelligent default caching behaviors optimized for both development and production environments, and flexible configuration for handling multiple static directories with custom URL prefixes.","language":"javascript","status":"active","version":"2.3.1","tags":["javascript","egg","egg-plugin","eggPlugin","static"],"last_verified":"Wed May 27","install":[{"cmd":"npm install egg-static","imports":["// {app_root}/config/plugin.js\nexports.static = {\n  enable: true,\n  package: 'egg-static',\n};","// {app_root}/config/config.default.js\nmodule.exports = appInfo => {\n  const config = {};\n  config.static = {\n    prefix: '/public/',\n    dir: path.join(appInfo.baseDir, 'app/public'),\n    maxAge: appInfo.env === 'prod' ? 31536000 : 0,\n  };\n  return config;\n};","// {app_root}/config/config.default.js\nexports.static = {\n  dir: [\n    path.join(appInfo.baseDir, 'app/public'),\n    { prefix: '/assets', dir: path.join(appInfo.baseDir, 'client/dist') }\n  ],\n};"]},{"cmd":"yarn add egg-static","imports":[]},{"cmd":"pnpm add egg-static","imports":[]}],"homepage":"https://eggjs.org","github":"https://github.com/eggjs/egg-static","docs":null,"changelog":null,"pypi":null,"npm":"https://www.npmjs.com/package/egg-static","openapi_spec":null,"status_page":null,"smithery":null,"compatibility":{"summary":{"python_range":"18–22","success_rate":0,"avg_install_s":null,"avg_import_s":null,"wheel_type":null},"url":"https://checklist.day/v1/registry/egg-static/compatibility"}}