1 Star 0 Fork 0

KwooShung / react-progressbar-wrapper

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
vite.config.ts 2.22 KB
一键复制 编辑 原始数据 按行查看 历史
KwooShung 提交于 2024-02-18 11:43 . 🐛 fix(lib): Repair export
import { defineConfig } from 'vitest/config';
import react from '@vitejs/plugin-react-swc';
// import vitePluginImp from 'vite-plugin-imp';
import dts from 'vite-plugin-dts';
// https://vitejs.dev/config/
export default defineConfig({
base: './',
server: {
port: 3000,
host: '0.0.0.0'
},
plugins: [
react(),
// vitePluginImp({
// libList: [
// {
// libName: 'lodash',
// libDirectory: '',
// camel2DashComponentName: false
// },
// {
// libName: '@arco-design/web-react',
// libDirectory: 'es',
// camel2DashComponentName: false,
// style(name) {
// return `@arco-design/web-react/es/${name}/style/index.js`;
// }
// }
// ]
// }),
dts({
rollupTypes: true,
insertTypesEntry: true,
copyDtsFiles: true
})
],
test: {
globals: true,
setupFiles: './vitest-setup.ts',
environment: 'jsdom',
include: ['src/progressbar/*.test.{ts,tsx}'],
exclude: ['**/node_modules/**', '**/dist/**'],
coverage: {
include: ['src/progressbar/*.{ts,tsx}'],
exclude: ['**/*.test.{ts,tsx}', '**/node_modules/**', '**/dist/**', '**/*.d.ts*']
}
},
css: {
modules: {
// generateScopedName: '[name]__[local]'
generateScopedName: '[local]'
}
},
build: {
minify: 'terser',
lib: {
entry: 'src/index.ts',
name: 'ReactProgressbarWrapper',
formats: ['cjs', 'es', 'umd'],
fileName: (format) => `index.${format === 'es' ? 'esm' : format === 'cjs' ? 'cmd' : format}.js`
},
rollupOptions: {
// 确保外部化处理那些你不想打包进库的依赖
external: ['react', 'react-dom', 'react/jsx-runtime', 'classnames', '@kwooshung/randoms'],
output: {
// 为各种格式提供全局变量名
globals: {
react: 'react',
'react-dom': 'ReactDOM',
'react/jsx-runtime': 'react/jsx-runtime'
},
// 这里定义了静态资源构建输出的命名
assetFileNames: (assetInfo) => {
if (assetInfo.name === 'style.css') {
return 'index.css';
}
return assetInfo.name;
}
}
}
}
});
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/kwooshung/react-progressbar-wrapper.git
git@gitee.com:kwooshung/react-progressbar-wrapper.git
kwooshung
react-progressbar-wrapper
react-progressbar-wrapper
main

搜索帮助

344bd9b3 5694891 D2dac590 5694891