{"id":17910880,"url":"https://github.com/sudongyuer/unplugin-hot-export","last_synced_at":"2026-01-20T13:32:34.322Z","repository":{"id":49775559,"uuid":"518010193","full_name":"sudongyuer/unplugin-hot-export","owner":"sudongyuer","description":"✨ Auto export files support webpack vite rollup esbuild","archived":false,"fork":false,"pushed_at":"2022-08-29T17:17:39.000Z","size":1322,"stargazers_count":2,"open_issues_count":2,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-09-15T19:50:03.824Z","etag":null,"topics":["auto-export","esbuild","hmr","vite","webpack"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/unplugin-hot-export","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sudongyuer.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null},"funding":{"github":"sudongyuer"}},"created_at":"2022-07-26T10:12:58.000Z","updated_at":"2024-05-08T13:10:47.000Z","dependencies_parsed_at":"2022-08-30T14:12:01.446Z","dependency_job_id":null,"html_url":"https://github.com/sudongyuer/unplugin-hot-export","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/sudongyuer/unplugin-hot-export","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sudongyuer%2Funplugin-hot-export","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sudongyuer%2Funplugin-hot-export/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sudongyuer%2Funplugin-hot-export/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sudongyuer%2Funplugin-hot-export/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sudongyuer","download_url":"https://codeload.github.com/sudongyuer/unplugin-hot-export/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sudongyuer%2Funplugin-hot-export/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28603766,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-20T12:01:53.233Z","status":"ssl_error","status_checked_at":"2026-01-20T12:01:46.545Z","response_time":117,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["auto-export","esbuild","hmr","vite","webpack"],"created_at":"2024-10-28T19:35:14.504Z","updated_at":"2026-01-20T13:32:34.306Z","avatar_url":"https://github.com/sudongyuer.png","language":"TypeScript","funding_links":["https://github.com/sponsors/sudongyuer"],"categories":[],"sub_categories":[],"readme":"# unplugin-hot-export\n\n\n\nAutomatically export files with HMR\n\n[![NPM version](https://badge.fury.io/js/unplugin-hot-export.svg)](https://www.npmjs.com/package/unplugin-hot-export)\n\n\n\u003cp align='center'\u003e\n\u003cimg src='https://git.poker/sudongyuer/image-bed/blob/master/20220714/vite-plugin-auto-export-logo.1aoaypaggq5c.png?raw=true' width='200'/\u003e\n\u003c/p\u003e\n\n## Why ?\n\nWhen developing, we often need to download some `images` or `svg` from the internet, and when we need to use them, we need export them in `index.ts` file `manually`, this plugin can handle this for you `automatically`.And support HMR 🌈\n\n## 🚀 Features\n\n- 👻 Multiple directory generate support\n- 🍁 Auto export files\n- 🐥 custom outputDir\n- 🍄 Support custom import statement\n- ✨ HMR support \n- 🌈 Nest directory generate support\n- 🍣 Auto Prefix support\n\n\n## 📺 Preview\n\n\u003cp align='center'\u003e\n\u003cimg src='https://git.poker/sudongyuer/image-bed/blob/master/20220717/屏幕录制2022-07-17-11.2ia7q69awd00.gif?raw=true' width='100%'/\u003e\n\u003c/p\u003e\n\n\n## 🦄 Usage\n\n### Install\n\n```bash\npnpm add -D unplugin-hot-export\n```\n\n\u003cdetails\u003e\n\u003csummary\u003eVite\u003c/summary\u003e\u003cbr\u003e\n\n```ts\n// vite.config.ts\nimport { vitePlugin as HotExport } from 'unplugin-hot-export'\n\nexport default defineConfig({\n  plugins: [HotExport()],\n})\n```\n\n\u003cbr\u003e\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003eRollup\u003c/summary\u003e\u003cbr\u003e\n\n```ts\n// rollup.config.js\nimport { rollupPlugin as HotExport } from 'unplugin-hot-export'\n\nexport default {\n  plugins: [HotExport()],\n}\n```\n\n\u003cbr\u003e\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003eesbuild\u003c/summary\u003e\u003cbr\u003e\n\n```ts\n// esbuild.config.js\nimport { build } from 'esbuild'\nconst HotExport = require('unplugin-hot-export')\nbuild({\n  plugins: [HotExport.esbuildPlugin()],\n})\n```\n\n\u003cbr\u003e\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003eWebpack\u003c/summary\u003e\u003cbr\u003e\n\n```ts\n// webpack.config.js\nconst HotExport = require('unplugin-hot-export')\nmodule.exports = {\n  /* ... */\n  plugins: [HotExport.webpackPlugin()],\n}\n```\n\n\u003cbr\u003e\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003eNextJs\u003c/summary\u003e\u003cbr\u003e\n\n```ts\n// next.config.js\nconst HotExport = require('unplugin-hot-export')\n/** @type {import('next').NextConfig} */\nconst nextConfig = {\n  reactStrictMode: true,\n  swcMinify: true,\n  webpack: (config, _) =\u003e {\n    config.plugins.push(HotExport.webpackPlugin())\n    return config\n  },\n  eslint: {\n    ignoreDuringBuilds: true,\n  },\n}\n\nmodule.exports = nextConfig\n```\n\n\u003cbr\u003e\u003c/details\u003e\n\n\n\n\n### Config `export.config.ts`\n\n- targetDir (require) : the directory to export files\n\n- outputDir (optional,default targetDir) : the directory to generate the `index.ts` file to export files\n\n- customImport (optional) : custom the import statement to use in the `index.ts` file \n\n- depth (optional , default true) : traverse all subdirectories\n\n- autoPrefix (optional , default false) : auto add prefix to the file name. Note that the if you open the customImport option,this option will be ignored\n\n```js\nimport { defineExportConfig } from 'unplugin-hot-export'\nexport default defineExportConfig({\n  configs: [\n    {\n      targetDir: './src/assets/images',\n    },\n    {\n      targetDir: './src/assets/img',\n      depth: true,\n      autoPrefix: true\n    },\n    {\n      targetDir: './src/assets/css',\n      outputDir: './src/assets/css',\n    },\n    {\n      targetDir: './src/assets/svgs',\n      customImport: (fileName, file) =\u003e {\n        return `import { ReactComponent as ${fileName} } from '${file}'`\n      },\n    },\n    {\n      targetDir: './src/assets/gif',\n      customImport: (fileName, file, fileType) =\u003e {\n        return `import ${fileType}${fileName} from '${file}'`\n      },\n      depth: true\n    },\n  ],\n})\n\n```\n\nThen start your project\n```bash\npnpm run dev\n```\n## Not Work?\n\nIf you are use webstorm, please check the following:\n\n![image-20220717101450402](https://tva1.sinaimg.cn/large/e6c9d24egy1h49pefcb4jj21580u0wi5.jpg)\n\n\n## Author\n\nsudongyuer email:976499226@qq.com\n\n## 📄 License\n\n[MIT](./LICENSE) License © 2021 [SuDongYu](https://github.com/sudongyuer)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsudongyuer%2Funplugin-hot-export","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsudongyuer%2Funplugin-hot-export","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsudongyuer%2Funplugin-hot-export/lists"}