diff --git a/modules/build-engine/src/engine-js/index.ts b/modules/build-engine/src/engine-js/index.ts index 0220461..14fee02 100644 --- a/modules/build-engine/src/engine-js/index.ts +++ b/modules/build-engine/src/engine-js/index.ts @@ -28,7 +28,7 @@ import rollup = Bundler.core; import rpBabel = Bundler.plugins.babel.babel; import RollupBabelInputPluginOptions = Bundler.plugins.babel.RollupBabelInputPluginOptions; import json = Bundler.plugins.json; -import resolve = Bundler.plugins.nodeResolve; +import nodeResolve = Bundler.plugins.nodeResolve; import commonjs = Bundler.plugins.commonjs; import rpTerser = Bundler.plugins.terser; import rpVirtual = Bundler.plugins.virtual; @@ -285,7 +285,7 @@ export async function buildJsEngine(options: Required): Pro configFileName: ps.resolve(options.engine, 'tsconfig.json'), }), - resolve({ + nodeResolve({ extensions: ['.js', '.ts', '.json'], jail: await realPath(engineRoot), rootDir: engineRoot, @@ -295,7 +295,6 @@ export async function buildJsEngine(options: Required): Pro preferConst: true, }), - commonjs({ include: [ /node_modules[/\\]/, @@ -351,6 +350,11 @@ export async function buildJsEngine(options: Required): Pro // We only do this for CommonJS. // Especially, we cannot do this for IIFE. toplevel: rollupFormat === 'cjs', + // Enabling 'split' will have more than one entry, nameCache will not be able to be shared by different workers in rollup-plugin-terser. + // So disable worker if 'split' mode is enabled. + maxWorkers: split ? 0 : undefined, + // Use name cache if it's in 'split' mode. + nameCache: split ? {} : undefined, })); } diff --git a/modules/bundler/package.json b/modules/bundler/package.json index 53778d6..cdb4229 100644 --- a/modules/bundler/package.json +++ b/modules/bundler/package.json @@ -26,7 +26,7 @@ "@cocos/rollup-plugin-node-resolve": "^15.3.0", "@rollup/plugin-virtual": "^3.0.2", "@rollup/plugin-typescript": "~11.1.6", - "@cocos/rollup-plugin-terser": "^0.4.4", + "@cocos/rollup-plugin-terser": "^0.4.5", "fs-extra": "~11.1.1", "glob": "~7.2.0" }, diff --git a/package-lock.json b/package-lock.json index 754ad57..c948a18 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@cocos/ccbuild", - "version": "2.2.18", + "version": "2.2.19", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@cocos/ccbuild", - "version": "2.2.18", + "version": "2.2.19", "hasInstallScript": true, "license": "MIT", "workspaces": [ @@ -194,7 +194,7 @@ "license": "ISC", "dependencies": { "@cocos/rollup-plugin-node-resolve": "^15.3.0", - "@cocos/rollup-plugin-terser": "^0.4.4", + "@cocos/rollup-plugin-terser": "^0.4.5", "@rollup/plugin-babel": "^6.0.3", "@rollup/plugin-commonjs": "^26.0.1", "@rollup/plugin-json": "^6.1.0", @@ -2806,9 +2806,9 @@ } }, "node_modules/@cocos/rollup-plugin-terser": { - "version": "0.4.4", - "resolved": "https://registry.npmjs.org/@cocos/rollup-plugin-terser/-/rollup-plugin-terser-0.4.4.tgz", - "integrity": "sha512-r+0IlDny3nXDXZq/IMzkjE7TVV04JI7vttD1VO1kggXpYRkY5VyAGKYJV7GBt8ntHtq21LDlF5EyZEMtw8YmZg==", + "version": "0.4.5", + "resolved": "https://registry.npmjs.org/@cocos/rollup-plugin-terser/-/rollup-plugin-terser-0.4.5.tgz", + "integrity": "sha512-re21dIJ6P9lsJWvcc8oGNGqhwFRUzz/tbb/EoyOqlLv08cxjbaxEMuV30sCTw7hg0gXoZsNrwUx49tfWAj3WpQ==", "dependencies": { "jest-worker": "^29.7.0", "serialize-javascript": "^6.0.1", diff --git a/package.json b/package.json index d972e6b..c2c9c72 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@cocos/ccbuild", - "version": "2.2.18", + "version": "2.2.19", "description": "The next generation of build tool for Cocos engine.", "main": "./lib/index.js", "types": "./lib/index.d.ts",