我正在尝试使用 Vite 的库模式将 React 组件发布为 npm 模块。但即使我的条目文件不导入或使用图像,vite.svg它也会被复制到 dist 文件夹中。
vite.config.js:
\nexport default defineConfig({\n plugins: [react()],\n build: {\n lib: {\n // Could also be a dictionary or array of multiple entry points\n entry: resolve(__dirname, \'src/index.jsx\'),\n name: \'MyLib\',\n // the proper extensions will be added\n fileName: \'my-lib\',\n },\n rollupOptions: {\n // make sure to externalize deps that shouldn\'t be bundled\n // into your library\n external: [\'react\', \'react-dom\'],\n output: {\n // Provide global variables to use in the …Run Code Online (Sandbox Code Playgroud)