From 6adf76db42aa3d1837217d511db65fd657d30d0d Mon Sep 17 00:00:00 2001 From: zhangxin <59186205+chichinohaha@users.noreply.github.com> Date: Wed, 28 Sep 2022 15:23:30 +0800 Subject: [PATCH] _loadCCEScripts will be browser-preview only (#12925) * _loadCCEScripts will be browser-preview only * add comment --- cocos/core/game.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/cocos/core/game.ts b/cocos/core/game.ts index 4fc6ec9ce5..91df92755b 100644 --- a/cocos/core/game.ts +++ b/cocos/core/game.ts @@ -863,14 +863,14 @@ export class Game extends EventTarget { } /** - * @internal only for preview + * @internal only for browser preview */ private _loadCCEScripts () { return new Promise((resolve, reject) => { - if (PREVIEW && !TEST) { + // Since there is no script in the bundle during preview, we need to load the user's script in the following way + if (PREVIEW && !TEST && !EDITOR && !NATIVE) { const bundneName = 'cce:/internal/x/prerequisite-imports'; - import(bundneName) - .then(() => resolve(), (reason) => reject(reason)); + import(bundneName).then(() => resolve(), (reason) => reject(reason)); } else { resolve(); }