You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
27 lines
722 B
27 lines
722 B
import { defineConfig } from 'vite'; |
|
import react from '@vitejs/plugin-react-swc'; |
|
import { resolve } from 'path'; |
|
|
|
// https://vitejs.dev/config/ |
|
export default defineConfig({ |
|
plugins: [react()], |
|
build: { |
|
lib: { |
|
entry: resolve(__dirname, './src/Timer/index.tsx'), |
|
name: 'timer', |
|
fileName: (format) => `timer.${format}.js`, |
|
}, |
|
rollupOptions: { |
|
// 确保外部化处理那些你不想打包进库的依赖 |
|
external: ['react', 'react-dom'], |
|
output: { |
|
// 在 UMD 构建模式下为这些外部化的依赖提供一个全局变量 |
|
globals: { |
|
react: 'React', |
|
'react-dom': 'react-dom', |
|
}, |
|
}, |
|
}, |
|
outDir: 'lib', |
|
}, |
|
});
|
|
|