1
0
mirror of synced 2025-12-13 05:37:55 +08:00

build: 统一构建

This commit is contained in:
roymondchen
2025-01-21 19:13:01 +08:00
parent 51ca1e60af
commit 5c0cfe44dd
47 changed files with 276 additions and 1170 deletions

View File

@@ -27,9 +27,6 @@
"src"
],
"license": "Apache-2.0",
"scripts": {
"build": "vite build"
},
"engines": {
"node": ">=18"
},
@@ -42,13 +39,7 @@
"lodash-es": "^4.17.21"
},
"devDependencies": {
"@types/lodash-es": "^4.17.4",
"@types/node": "^18.19.0",
"@vitejs/plugin-vue": "^5.2.1",
"@vue/compiler-sfc": "^3.5.13",
"rimraf": "^3.0.2",
"sass": "^1.83.0",
"vite": "^6.0.9"
"@types/lodash-es": "^4.17.4"
},
"peerDependencies": {
"@tmagic/design": "workspace:*",

View File

@@ -1,58 +0,0 @@
/*
* Tencent is pleased to support the open source community by making TMagicEditor available.
*
* Copyright (C) 2023 THL A29 Limited, a Tencent company. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { defineConfig } from 'vite';
import vue from '@vitejs/plugin-vue';
import pkg from './package.json';
export default defineConfig({
plugins: [vue()],
build: {
cssCodeSplit: false,
sourcemap: false,
minify: false,
target: 'esnext',
lib: {
entry: 'src/index.ts',
name: 'TMagicTable',
fileName: 'tmagic-table',
cssFileName: 'style',
},
rollupOptions: {
// 确保外部化处理那些你不想打包进库的依赖
external(id: string) {
return Object.keys({
...pkg.dependencies,
...pkg.peerDependencies,
}).some((k) => new RegExp(`^${k}`).test(id));
},
output: {
// 在 UMD 构建模式下为这些外部化的依赖提供一个全局变量
globals: {
vue: 'Vue',
'element-plus': 'ElementPlus',
},
},
},
},
});