更新库rollup配置
This commit is contained in:
@@ -46,6 +46,7 @@ function generatePackageJson() {
|
||||
description: sourcePackage.description,
|
||||
main: 'index.cjs',
|
||||
module: 'index.mjs',
|
||||
unpkg: 'index.umd.js',
|
||||
types: 'index.d.ts',
|
||||
exports: {
|
||||
'.': {
|
||||
@@ -59,6 +60,8 @@ function generatePackageJson() {
|
||||
'index.mjs.map',
|
||||
'index.cjs',
|
||||
'index.cjs.map',
|
||||
'index.umd.js',
|
||||
'index.umd.js.map',
|
||||
'index.d.ts',
|
||||
'README.md',
|
||||
'LICENSE'
|
||||
@@ -67,7 +70,7 @@ function generatePackageJson() {
|
||||
'ecs',
|
||||
'networking',
|
||||
'frame-sync',
|
||||
'protobuf',
|
||||
'tsrpc',
|
||||
'serialization',
|
||||
'multiplayer',
|
||||
'game-engine',
|
||||
@@ -77,14 +80,13 @@ function generatePackageJson() {
|
||||
author: sourcePackage.author,
|
||||
license: sourcePackage.license,
|
||||
repository: sourcePackage.repository,
|
||||
bugs: sourcePackage.bugs,
|
||||
homepage: sourcePackage.homepage,
|
||||
engines: {
|
||||
node: '>=16.0.0'
|
||||
},
|
||||
dependencies: {
|
||||
'@esengine/ecs-framework': sourcePackage.peerDependencies['@esengine/ecs-framework'],
|
||||
'protobufjs': sourcePackage.dependencies.protobufjs,
|
||||
'reflect-metadata': sourcePackage.dependencies['reflect-metadata']
|
||||
},
|
||||
dependencies: sourcePackage.dependencies,
|
||||
peerDependencies: sourcePackage.peerDependencies,
|
||||
sideEffects: false
|
||||
};
|
||||
|
||||
@@ -109,7 +111,7 @@ function copyFiles() {
|
||||
|
||||
function showBuildResults() {
|
||||
const distDir = './dist';
|
||||
const files = ['index.mjs', 'index.cjs', 'index.d.ts'];
|
||||
const files = ['index.mjs', 'index.cjs', 'index.umd.js', 'index.d.ts'];
|
||||
|
||||
console.log('\n📊 构建结果:');
|
||||
files.forEach(file => {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@esengine/ecs-framework-network",
|
||||
"version": "1.0.1",
|
||||
"version": "1.0.2",
|
||||
"description": "ECS框架网络插件 - 提供TSRPC网络通信、帧同步和快照功能",
|
||||
"type": "module",
|
||||
"main": "bin/index.js",
|
||||
|
||||
@@ -82,6 +82,36 @@ module.exports = [
|
||||
}
|
||||
},
|
||||
|
||||
// UMD构建 - 用于CDN和浏览器直接使用
|
||||
{
|
||||
input: 'bin/index.js',
|
||||
output: {
|
||||
file: 'dist/index.umd.js',
|
||||
format: 'umd',
|
||||
name: 'ECSNetwork',
|
||||
banner,
|
||||
sourcemap: true,
|
||||
exports: 'named',
|
||||
globals: {
|
||||
'@esengine/ecs-framework': 'ECS',
|
||||
'protobufjs': 'protobuf',
|
||||
'reflect-metadata': 'Reflect'
|
||||
}
|
||||
},
|
||||
plugins: [
|
||||
...commonPlugins,
|
||||
terser({
|
||||
format: {
|
||||
comments: /^!/
|
||||
}
|
||||
})
|
||||
],
|
||||
external: ['@esengine/ecs-framework', 'protobufjs', 'reflect-metadata'],
|
||||
treeshake: {
|
||||
moduleSideEffects: false
|
||||
}
|
||||
},
|
||||
|
||||
// 类型定义构建
|
||||
{
|
||||
input: 'bin/index.d.ts',
|
||||
|
||||
Reference in New Issue
Block a user