fix: 修复npm包构建和发布问题 - 将esbuild target从es2017升级到es2020以支持BigInt - 修复浏览器环境下Node.js模块依赖问题 - 添加define配置处理require等Node.js全局变量 - 成功发布@esengine/ecs-framework@2.1.7到npm
This commit is contained in:
4
source/package-lock.json
generated
4
source/package-lock.json
generated
@@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "@esengine/ecs-framework",
|
"name": "@esengine/ecs-framework",
|
||||||
"version": "2.1.6",
|
"version": "2.1.7",
|
||||||
"lockfileVersion": 3,
|
"lockfileVersion": 3,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "@esengine/ecs-framework",
|
"name": "@esengine/ecs-framework",
|
||||||
"version": "2.1.6",
|
"version": "2.1.7",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/node": "^20.19.0",
|
"@types/node": "^20.19.0",
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@esengine/ecs-framework",
|
"name": "@esengine/ecs-framework",
|
||||||
"version": "2.1.6",
|
"version": "2.1.7",
|
||||||
"description": "用于Laya、Cocos等游戏引擎的高性能ECS框架",
|
"description": "用于Laya、Cocos等游戏引擎的高性能ECS框架",
|
||||||
"main": "bin/index.js",
|
"main": "bin/index.js",
|
||||||
"types": "bin/index.d.ts",
|
"types": "bin/index.d.ts",
|
||||||
|
|||||||
@@ -21,8 +21,8 @@ const config = {
|
|||||||
minify: true,
|
minify: true,
|
||||||
sourcemap: true,
|
sourcemap: true,
|
||||||
|
|
||||||
// 目标环境 - 适配更多平台
|
// 目标环境 - 支持BigInt等ES2020特性
|
||||||
target: ['es2017'],
|
target: ['es2020'],
|
||||||
format: 'esm',
|
format: 'esm',
|
||||||
|
|
||||||
// npm包配置
|
// npm包配置
|
||||||
@@ -50,14 +50,20 @@ async function buildSingleFile() {
|
|||||||
target: config.target,
|
target: config.target,
|
||||||
format: config.format,
|
format: config.format,
|
||||||
outfile: path.join(config.outputDir, config.outputFile),
|
outfile: path.join(config.outputDir, config.outputFile),
|
||||||
platform: 'neutral', // 支持多平台
|
platform: 'browser', // 浏览器环境
|
||||||
|
|
||||||
// 外部依赖
|
// 外部依赖
|
||||||
external: [],
|
external: [],
|
||||||
|
|
||||||
|
// 定义Node.js模块的浏览器替代
|
||||||
|
inject: [],
|
||||||
|
|
||||||
// 定义全局变量
|
// 定义全局变量
|
||||||
define: {
|
define: {
|
||||||
'process.env.NODE_ENV': '"production"'
|
'process.env.NODE_ENV': '"production"',
|
||||||
|
'require': 'undefined',
|
||||||
|
'__filename': '""',
|
||||||
|
'__dirname': '""'
|
||||||
},
|
},
|
||||||
|
|
||||||
// 元信息
|
// 元信息
|
||||||
|
|||||||
Reference in New Issue
Block a user