1 Star 0 Fork 0

leopen / react-lib-boilerplate

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
vite.config.ts 793 Bytes
一键复制 编辑 原始数据 按行查看 历史
import { resolve } from 'path'
import { defineConfig } from 'vite'
import dts from 'vite-plugin-dts'
import reactRefresh from '@vitejs/plugin-react-refresh'
// https://vitejs.dev/config/
export default defineConfig({
plugins: [
reactRefresh(),
dts({
include: ['src'],
outputDir: 'dist/types',
insertTypesEntry: true,
logDiagnostics: true,
}),
],
esbuild: {
jsxInject: `import React from 'react'`,
},
build: {
lib: {
entry: resolve(__dirname, 'src/index.tsx'),
name: 'ReactLibBoilerplate',
},
rollupOptions: {
external: ['react'],
output: {
// 在 UMD 构建模式下为这些外部化的依赖提供一个全局变量
globals: {
react: 'React',
},
},
},
},
})
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/leopen/react-lib-boilerplate.git
git@gitee.com:leopen/react-lib-boilerplate.git
leopen
react-lib-boilerplate
react-lib-boilerplate
master

搜索帮助

344bd9b3 5694891 D2dac590 5694891