diff --git a/cocos/game/game.ts b/cocos/game/game.ts index 76fcb34e230..71abe58a31e 100644 --- a/cocos/game/game.ts +++ b/cocos/game/game.ts @@ -993,8 +993,10 @@ export class Game extends EventTarget { return new Promise((resolve, reject): void => { // 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((): void => resolve(), (reason): void => reject(reason)); + const bundleName = 'cce:/internal/x/prerequisite-imports'; + import(bundleName).then((): void => resolve(), (reason): void => reject(reason)); + } else if (EDITOR && !EDITOR_NOT_IN_PREVIEW) { + globalThis.cce.Script && globalThis.cce.Script.init().then(() => resolve()); } else { resolve(); }