1 Star 0 Fork 0

清风徐来/form-create-designer-next

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
vite.config.build.js 2.15 KB
一键复制 编辑 原始数据 按行查看 历史
清风徐来 提交于 2024-01-24 16:12 . asdasd
import {defineConfig} from 'vite'
import vue from '@vitejs/plugin-vue'
import vueJSX from '@vitejs/plugin-vue-jsx'
import banner from 'vite-plugin-banner'
import cssnano from 'cssnano'
import visualizer from 'rollup-plugin-visualizer';
import cssInjectedByJsPlugin from 'vite-plugin-css-injected-by-js'
import {author, license, name, version} from './package.json'
const extnedsPlugins = [];
function getBanner(banner, pkg) {
if (!banner || typeof banner === 'string') {
return banner || '';
}
banner = {...pkg, ...(banner === true ? {} : banner)};
const author =banner.author
const license = banner.license || '';
return (
'/*!\n' +
' * form-create 可视化表单设计器\n' +
` * ${banner.name} v${banner.version}\n` +
` * (c) ${author || ''}\n` +
(license && ` * Released under the ${license} License.\n`) +
' */'
);
}
const __banner__ = {
author: `2021-${new Date().getFullYear()} ${author}\n * Github https://github.com/xaboy/form-create-designer`,
license,
name,
version
}
// 打包生产环境才引入的插件
if (process.env.NODE_ENV === 'production') {
// 打包依赖展示
extnedsPlugins.push(
visualizer({
open: true,
gzipSize: true,
brotliSize: true,
})
);
}
// https://vitejs.dev/config/
export default defineConfig({
build: {
lib: {
entry: 'src/index.js',
name: 'FcDesigner',
fileName: format => `index.${format}.js`,
},
rollupOptions: {
output: {
exports: 'named',
globals: {
vue: 'Vue'
}
},
external: [
'vue',
'element-plus',
'@form-create/element-ui'
],
},
brotliSize: true
},
css: {
postcss: {
plugins: [
cssnano({
preset: 'advanced'
})
]
}
},
plugins: [vue(), vueJSX(), banner(getBanner(__banner__)),cssInjectedByJsPlugin(), ...extnedsPlugins]
})
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/baoyukun/form-create-designer-next.git
[email protected]:baoyukun/form-create-designer-next.git
baoyukun
form-create-designer-next
form-create-designer-next
master

搜索帮助