From ec5f70ecfcfafb2cc711b5274838bd0939438c11 Mon Sep 17 00:00:00 2001 From: YHH <359807859@qq.com> Date: Mon, 9 Jun 2025 13:34:46 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8Dnpm=E5=8C=85=E6=9E=84?= =?UTF-8?q?=E5=BB=BA=E5=92=8C=E5=8F=91=E5=B8=83=E9=97=AE=E9=A2=98=20-=20?= =?UTF-8?q?=E5=B0=86esbuild=20target=E4=BB=8Ees2017=E5=8D=87=E7=BA=A7?= =?UTF-8?q?=E5=88=B0es2020=E4=BB=A5=E6=94=AF=E6=8C=81BigInt=20-=20?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=B5=8F=E8=A7=88=E5=99=A8=E7=8E=AF=E5=A2=83?= =?UTF-8?q?=E4=B8=8BNode.js=E6=A8=A1=E5=9D=97=E4=BE=9D=E8=B5=96=E9=97=AE?= =?UTF-8?q?=E9=A2=98=20-=20=E6=B7=BB=E5=8A=A0define=E9=85=8D=E7=BD=AE?= =?UTF-8?q?=E5=A4=84=E7=90=86require=E7=AD=89Node.js=E5=85=A8=E5=B1=80?= =?UTF-8?q?=E5=8F=98=E9=87=8F=20-=20=E6=88=90=E5=8A=9F=E5=8F=91=E5=B8=83@e?= =?UTF-8?q?sengine/ecs-framework@2.1.7=E5=88=B0npm?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- source/package-lock.json | 4 ++-- source/package.json | 2 +- source/scripts/build-single.js | 14 ++++++++++---- 3 files changed, 13 insertions(+), 7 deletions(-) diff --git a/source/package-lock.json b/source/package-lock.json index ad30a72b..1d524f28 100644 --- a/source/package-lock.json +++ b/source/package-lock.json @@ -1,12 +1,12 @@ { "name": "@esengine/ecs-framework", - "version": "2.1.6", + "version": "2.1.7", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@esengine/ecs-framework", - "version": "2.1.6", + "version": "2.1.7", "license": "MIT", "devDependencies": { "@types/node": "^20.19.0", diff --git a/source/package.json b/source/package.json index b17c4c6a..75ed2826 100644 --- a/source/package.json +++ b/source/package.json @@ -1,6 +1,6 @@ { "name": "@esengine/ecs-framework", - "version": "2.1.6", + "version": "2.1.7", "description": "用于Laya、Cocos等游戏引擎的高性能ECS框架", "main": "bin/index.js", "types": "bin/index.d.ts", diff --git a/source/scripts/build-single.js b/source/scripts/build-single.js index 45b80d1a..610fa8e8 100644 --- a/source/scripts/build-single.js +++ b/source/scripts/build-single.js @@ -21,8 +21,8 @@ const config = { minify: true, sourcemap: true, - // 目标环境 - 适配更多平台 - target: ['es2017'], + // 目标环境 - 支持BigInt等ES2020特性 + target: ['es2020'], format: 'esm', // npm包配置 @@ -50,14 +50,20 @@ async function buildSingleFile() { target: config.target, format: config.format, outfile: path.join(config.outputDir, config.outputFile), - platform: 'neutral', // 支持多平台 + platform: 'browser', // 浏览器环境 // 外部依赖 external: [], + // 定义Node.js模块的浏览器替代 + inject: [], + // 定义全局变量 define: { - 'process.env.NODE_ENV': '"production"' + 'process.env.NODE_ENV': '"production"', + 'require': 'undefined', + '__filename': '""', + '__dirname': '""' }, // 元信息