更新支持es5环境
This commit is contained in:
1647
package-lock.json
generated
1647
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
18
packages/core/.babelrc
Normal file
18
packages/core/.babelrc
Normal file
@@ -0,0 +1,18 @@
|
||||
{
|
||||
"presets": [
|
||||
[
|
||||
"@babel/preset-env",
|
||||
{
|
||||
"targets": {
|
||||
"browsers": ["> 1%", "last 2 versions", "ie >= 11"]
|
||||
},
|
||||
"modules": false,
|
||||
"loose": true
|
||||
}
|
||||
]
|
||||
],
|
||||
"plugins": [
|
||||
"@babel/plugin-transform-optional-chaining",
|
||||
"@babel/plugin-transform-nullish-coalescing-operator"
|
||||
]
|
||||
}
|
||||
@@ -62,6 +62,8 @@ function generatePackageJson() {
|
||||
'index.cjs.map',
|
||||
'index.umd.js',
|
||||
'index.umd.js.map',
|
||||
'index.es5.js',
|
||||
'index.es5.js.map',
|
||||
'index.d.ts',
|
||||
'README.md',
|
||||
'LICENSE',
|
||||
@@ -113,7 +115,7 @@ function copyFiles() {
|
||||
|
||||
function showBuildResults() {
|
||||
const distDir = './dist';
|
||||
const files = ['index.mjs', 'index.cjs', 'index.umd.js', 'index.d.ts'];
|
||||
const files = ['index.mjs', 'index.cjs', 'index.umd.js', 'index.es5.js', 'index.d.ts'];
|
||||
|
||||
console.log('\n📊 构建结果:');
|
||||
files.forEach(file => {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@esengine/ecs-framework",
|
||||
"version": "2.1.45",
|
||||
"version": "2.1.46",
|
||||
"description": "用于Laya、Cocos Creator等JavaScript游戏引擎的高性能ECS框架",
|
||||
"main": "bin/index.js",
|
||||
"types": "bin/index.d.ts",
|
||||
@@ -51,6 +51,11 @@
|
||||
"author": "yhh",
|
||||
"license": "MIT",
|
||||
"devDependencies": {
|
||||
"@babel/core": "^7.28.3",
|
||||
"@babel/plugin-transform-nullish-coalescing-operator": "^7.27.1",
|
||||
"@babel/plugin-transform-optional-chaining": "^7.27.1",
|
||||
"@babel/preset-env": "^7.28.3",
|
||||
"@rollup/plugin-babel": "^6.0.4",
|
||||
"@rollup/plugin-commonjs": "^28.0.3",
|
||||
"@rollup/plugin-node-resolve": "^16.0.1",
|
||||
"@rollup/plugin-terser": "^0.4.4",
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
const resolve = require('@rollup/plugin-node-resolve');
|
||||
const commonjs = require('@rollup/plugin-commonjs');
|
||||
const terser = require('@rollup/plugin-terser');
|
||||
const babel = require('@rollup/plugin-babel');
|
||||
const dts = require('rollup-plugin-dts').default;
|
||||
const { readFileSync } = require('fs');
|
||||
|
||||
@@ -23,6 +24,11 @@ const commonPlugins = [
|
||||
}),
|
||||
commonjs({
|
||||
include: /node_modules/
|
||||
}),
|
||||
babel({
|
||||
babelHelpers: 'bundled',
|
||||
exclude: 'node_modules/**',
|
||||
extensions: ['.js', '.ts']
|
||||
})
|
||||
];
|
||||
|
||||
@@ -101,6 +107,60 @@ module.exports = [
|
||||
moduleSideEffects: false
|
||||
}
|
||||
},
|
||||
|
||||
// ES5兼容构建 - 适用于只支持ES5语法的JavaScript环境
|
||||
{
|
||||
input: 'bin/index.js',
|
||||
output: {
|
||||
file: 'dist/index.es5.js',
|
||||
format: 'cjs',
|
||||
banner: banner + '\n// ES5 Compatible Build for legacy JavaScript environments',
|
||||
sourcemap: true,
|
||||
exports: 'named'
|
||||
},
|
||||
plugins: [
|
||||
resolve({
|
||||
browser: true,
|
||||
preferBuiltins: false
|
||||
}),
|
||||
commonjs({
|
||||
include: /node_modules/
|
||||
}),
|
||||
babel({
|
||||
babelHelpers: 'bundled',
|
||||
exclude: 'node_modules/**',
|
||||
extensions: ['.js', '.ts'],
|
||||
presets: [
|
||||
['@babel/preset-env', {
|
||||
targets: {
|
||||
browsers: ['ie >= 9', 'chrome >= 30', 'firefox >= 30', 'safari >= 8']
|
||||
},
|
||||
modules: false,
|
||||
loose: true,
|
||||
forceAllTransforms: true
|
||||
}]
|
||||
],
|
||||
plugins: [
|
||||
'@babel/plugin-transform-optional-chaining',
|
||||
'@babel/plugin-transform-nullish-coalescing-operator'
|
||||
]
|
||||
}),
|
||||
terser({
|
||||
ecma: 5,
|
||||
format: {
|
||||
comments: /^!/
|
||||
},
|
||||
compress: {
|
||||
drop_console: false,
|
||||
drop_debugger: false
|
||||
}
|
||||
})
|
||||
],
|
||||
external: [],
|
||||
treeshake: {
|
||||
moduleSideEffects: false
|
||||
}
|
||||
},
|
||||
|
||||
// 类型定义构建
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user