8 Star 93 Fork 19

京东零售 / nutui-react

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
vite.config.build.locales.ts 1.07 KB
一键复制 编辑 原始数据 按行查看 历史
import { defineConfig } from 'vite'
import dts from 'vite-plugin-dts'
import path from 'path'
import { globSync } from 'glob'
import config from './package.json'
const banner = `/*!
* ${config.name} v${config.version} ${new Date()}
* (c) 2023 @jdf2e.
* Released under the MIT License.
*/`
interface Entries {
[key: string]: string
}
const entries: Entries = {}
const locales = globSync(`./src/locales/*.ts`)
locales.forEach((item: string) => {
entries[item.replace('.ts', '').replace('src/locales/', '')] = path.join(
__dirname,
item
)
})
export default defineConfig({
plugins: [
dts({
include: './src/locales/*.ts',
outDir: './dist/locales',
beforeWriteFile(filePath, content) {
return { filePath: filePath.replace('src/locales', ''), content }
},
}),
],
build: {
emptyOutDir: false,
lib: {
entry: '',
name: 'index',
formats: ['es'],
},
rollupOptions: {
input: entries,
output: {
banner,
dir: './dist/locales',
entryFileNames: '[name].js',
},
},
},
})
TypeScript
1
https://gitee.com/jd-platform-opensource/nutui-react.git
git@gitee.com:jd-platform-opensource/nutui-react.git
jd-platform-opensource
nutui-react
nutui-react
next

搜索帮助

53164aa7 5694891 3bd8fe86 5694891