Skip to content

Commit

Permalink
Fix the issue with incorrect initialization script order in the edito…
Browse files Browse the repository at this point in the history
…r preview (#18299)

* Fix the issue with incorrect initialization script order in the editor preview
  • Loading branch information
knoxHuang authored Feb 10, 2025
1 parent b9bf293 commit b76643a
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions cocos/game/game.ts
Original file line number Diff line number Diff line change
Expand Up @@ -993,8 +993,10 @@ export class Game extends EventTarget {
return new Promise<void>((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());

Check warning on line 999 in cocos/game/game.ts

View workflow job for this annotation

GitHub Actions / Run ESLint

Expected an assignment or function call and instead saw an expression
} else {
resolve();
}
Expand Down

0 comments on commit b76643a

Please sign in to comment.