添加打包启动

This commit is contained in:
2024-11-15 02:09:46 +08:00
parent 3c689c1cba
commit b4cca6e345
4 changed files with 45 additions and 10 deletions

View File

@@ -6,9 +6,13 @@ import commonjs from '@rollup/plugin-commonjs';
import json from '@rollup/plugin-json';
import path from 'path';
import alias from '@rollup/plugin-alias';
import esbuild from 'rollup-plugin-esbuild'
// import replace from '@rollup/plugin-replace';
import esbuild from 'rollup-plugin-esbuild';
import replace from '@rollup/plugin-replace';
const isDev = process.env.NODE_ENV === 'development';
// 是否内联应用,内联应用不会启动服务,只会导出 App 实例从package.json中获取
const exportApp = true;
console.log('isDev================:', isDev);
/**
* @type {import('rollup').RollupOptions}
*/
@@ -21,6 +25,12 @@ const config = {
format: 'esm',
},
plugins: [
replace({
preventAssignment: true, // // 避免替换时发生意外赋值
DEV_SERVER: JSON.stringify(isDev), // DEV_SERVE
EXPORT_APP: JSON.stringify(exportApp), // 是否内联应用
EXPORT_PORT: JSON.stringify(3006), // 导出端口
}),
alias({
// only esbuild needs to be configured
entries: [
@@ -54,7 +64,7 @@ const config = {
esbuild({
target: 'node22', // 目标为 Node.js 14
minify: false, // 启用代码压缩
tsconfig: 'tsconfig.json'
tsconfig: 'tsconfig.json',
}),
// typescript({
// declaration: false,