77 Star 808 Fork 196

GVP京东零售/nutui

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
vite.config.build.taro.vue.disperse.ts 2.14 KB
一键复制 编辑 原始数据 按行查看 历史
eiinu 提交于 2024-03-25 18:30 . chore: prettier format (#2995)
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import path from 'path'
import fs from 'fs-extra'
import configPkg from './src/config.json'
const input = {}
configPkg.nav.map((item) => {
item.packages.forEach((element) => {
const { name, exclude, taro, setup } = element
if (taro === false) return // 排除非 Taro 组件
if (exclude != true) {
if (setup === true) {
input[name] = `./src/packages/__VUE/${name.toLowerCase()}/index.taro.ts`
} else {
const filePath = path.join(`./src/packages/__VUE/${name.toLowerCase()}/index.taro.vue`)
input[name] = `./src/packages/__VUE/${name.toLowerCase()}/index${fs.existsSync(filePath) ? '.taro' : ''}.vue`
}
}
// }
})
})
export default defineConfig({
resolve: {
alias: [{ find: '@', replacement: path.resolve(__dirname, './src') }]
},
plugins: [
vue({
template: {
compilerOptions: {
isCustomElement: (tag) => {
return (
tag.startsWith('taro-') ||
tag.startsWith('scroll-view') ||
tag.startsWith('swiper') ||
tag.startsWith('swiper-item') ||
tag.startsWith('picker') ||
tag.startsWith('picker-view') ||
tag.startsWith('picker-view-column')
)
},
whitespace: 'preserve'
}
}
})
],
build: {
minify: false, // Taro 相关的构建不能开启,开启后会导致找不到模板
target: 'es2015',
lib: {
entry: '',
name: 'index',
// fileName: (format) => format,
formats: ['es']
},
rollupOptions: {
// 请确保外部化那些你的库中不需要的依赖
external: ['vue', 'vue-router', '@tarojs/taro', '@/packages/locale', '@nutui/icons-vue-taro'],
input,
output: {
paths: {
'@/packages/locale': '@nutui/nutui-taro/dist/packages/locale/lang'
},
dir: path.resolve(__dirname, './dist/packages'),
entryFileNames: (chunkInfo) => `${chunkInfo.name.toLowerCase()}/${chunkInfo.name}.js`,
plugins: []
}
},
emptyOutDir: false
}
})
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
JavaScript
1
https://gitee.com/jd-platform-opensource/nutui.git
[email protected]:jd-platform-opensource/nutui.git
jd-platform-opensource
nutui
nutui
v4

搜索帮助

0d507c66 1850385 C8b1a773 1850385