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': '""' }, // 元信息