Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement GameFi SDK for Cocos. #5

Merged
merged 3 commits into from
Jul 8, 2024
Merged

Implement GameFi SDK for Cocos. #5

merged 3 commits into from
Jul 8, 2024

Conversation

barinbritva
Copy link
Collaborator

@barinbritva barinbritva commented Jul 5, 2024

Now there is an error: Unexpected export statement in CJS module.

7-5-2024 18:35:11 - error: [Scene] {hidden(::SceneExecutorImportExceptionHandler::)} Error: Error: Unexpected export statement in CJS module.
  at @:1:8
    at Object.execute (file:///C:/project/ton/flappy-bird-cocos/client/temp/programming/packer-driver/targets/editor/chunks/a5/data:text/javascript,%0A%2F%2F%20This%20module%20is%20auto-generated%20to%20report%20error%20emitted%20when%20try%20to%20load%20module%20file%3A%2F%2F%2FC%3A%2Fproject%2Fton%2Fflappy-bird-cocos%2Fnode_modules%2F%40ton%2Fcocos-sdk%2Fdist%2Fcocos%2Fsrc%2Findex.js%20at%20runtime.%0Athrow%20new%20Error(%60Error%3A%20Unexpected%20export%20statement%20in%20CJS%20module.%0A%20%20at%20%40%3A1%3A8%60)%3B%0A%20%20%20%20%20%20%20%20:3:7)
    at doExec (C:\ProgramData\cocos\editors\Creator\3.8.3\resources\app.asar\node_modules\@editor\lib-programming\static\executor\systemjs-bridge\out\index.js:517:30)
    at postOrderExec (C:\ProgramData\cocos\editors\Creator\3.8.3\resources\app.asar\node_modules\@editor\lib-programming\static\executor\systemjs-bridge\out\index.js:508:21)
    at C:\ProgramData\cocos\editors\Creator\3.8.3\resources\app.asar\node_modules\@editor\lib-programming\static\executor\systemjs-bridge\out\index.js:493:28
    at Array.forEach (<anonymous>)
    at postOrderExec (C:\ProgramData\cocos\editors\Creator\3.8.3\resources\app.asar\node_modules\@editor\lib-programming\static\executor\systemjs-bridge\out\index.js:491:10)
    at C:\ProgramData\cocos\editors\Creator\3.8.3\resources\app.asar\node_modules\@editor\lib-programming\static\executor\systemjs-bridge\out\index.js:493:28
    at Array.forEach (<anonymous>)
    at postOrderExec (C:\ProgramData\cocos\editors\Creator\3.8.3\resources\app.asar\node_modules\@editor\lib-programming\static\executor\systemjs-bridge\out\index.js:491:10)
    at C:\ProgramData\cocos\editors\Creator\3.8.3\resources\app.asar\node_modules\@editor\lib-programming\static\executor\systemjs-bridge\out\index.js:440:12Error: [Scene] {hidden(::SceneExecutorImportExceptionHandler::)} Error: Error: Unexpected export statement in CJS module.
    at postOrderExec (C:\ProgramData\cocos\editors\Creator\3.8.3\resources\app.asar\node_modules\@editor\lib-programming\static\executor\systemjs-bridge\out\index.js:508:21)
    at C:\ProgramData\cocos\editors\Creator\3.8.3\resources\app.asar\node_modules\@editor\lib-programming\static\executor\systemjs-bridge\out\index.js:493:28
    at Array.forEach (<anonymous>)
    at postOrderExec (C:\ProgramData\cocos\editors\Creator\3.8.3\resources\app.asar\node_modules\@editor\lib-programming\static\executor\systemjs-bridge\out\index.js:491:10)
    at C:\ProgramData\cocos\editors\Creator\3.8.3\resources\app.asar\node_modules\@editor\lib-programming\static\executor\systemjs-bridge\out\index.js:493:28
    at Array.forEach (<anonymous>)
    at postOrderExec (C:\ProgramData\cocos\editors\Creator\3.8.3\resources\app.asar\node_modules\@editor\lib-programming\static\executor\systemjs-bridge\out\index.js:491:10)
    at C:\ProgramData\cocos\editors\Creator\3.8.3\resources\app.asar\node_modules\@editor\lib-programming\static\executor\systemjs-bridge\out\index.js:440:12
    at Logger._logHandler (C:\ProgramData\cocos\editors\Creator\3.8.3\resources\app.asar\builtin\scene\dist\script\3d\manager\startup\log.ccc:1:487)
    at Logger.record (C:\ProgramData\cocos\editors\Creator\3.8.3\resources\app.asar\node_modules\@base\electron-logger\lib\renderer.ccc:1:458)
    at console.error (C:\ProgramData\cocos\editors\Creator\3.8.3\resources\app.asar\node_modules\@base\electron-logger\lib\renderer.ccc:1:1414)
    at ScriptManager._handleImportException (C:\ProgramData\cocos\editors\Creator\3.8.3\resources\app.asar\builtin\scene\dist\script\3d\manager\scripts.ccc:1:5195)
    at Executor.importExceptionHandler [as _importExceptionHandler] (C:\ProgramData\cocos\editors\Creator\3.8.3\resources\app.asar\builtin\scene\dist\script\3d\manager\scripts.ccc:1:3379)
    at Executor._onModuleLoaded (C:\ProgramData\cocos\editors\Creator\3.8.3\resources\app.asar\node_modules\@editor\lib-programming\src\executor\index.ts:359:22)
    at SystemJS.onload (C:\ProgramData\cocos\editors\Creator\3.8.3\resources\app.asar\node_modules\@editor\lib-programming\src\executor\index.ts:96:18)
    at triggerOnload (C:\ProgramData\cocos\editors\Creator\3.8.3\resources\app.asar\node_modules\@editor\lib-programming\static\executor\systemjs-bridge\out\index.js:270:10)
    at doExec (C:\ProgramData\cocos\editors\Creator\3.8.3\resources\app.asar\node_modules\@editor\lib-programming\static\executor\systemjs-bridge\out\index.js:538:7)
    at postOrderExec (C:\ProgramData\cocos\editors\Creator\3.8.3\resources\app.asar\node_modules\@editor\lib-programming\static\executor\systemjs-bridge\out\index.js:508:21)
7-5-2024 18:35:11 - log: [Scene] [PHYSICS2D]: switch from box2d-wasm to box2d.
7-5-2024 18:35:14 - warn: [Scene] Missing class: 005f9OFOEZNWqyXICbdhSjIError: [Scene] Missing class: 005f9OFOEZNWqyXICbdhSjI
    at Object.classFinder (C:\ProgramData\cocos\editors\Creator\3.8.3\resources\app.asar\builtin\engine\dist\editor-extends\missing-reporter\missing-class-reporter.ccc:7:982)
    at _Deserializer.classFinder [as _classFinder] (C:\ProgramData\cocos\editors\Creator\3.8.3\resources\resources\3d\engine\bin\.cache\dev\editor\bundled\index.js:118036:34)
    at _Deserializer._deserializeTypeTaggedObject (C:\ProgramData\cocos\editors\Creator\3.8.3\resources\resources\3d\engine\bin\.cache\dev\editor\bundled\index.js:49035:30)
    at _Deserializer._deserializeObject (C:\ProgramData\cocos\editors\Creator\3.8.3\resources\resources\3d\engine\bin\.cache\dev\editor\bundled\index.js:48989:29)
    at _Deserializer._deserializeAndAssignField (C:\ProgramData\cocos\editors\Creator\3.8.3\resources\resources\3d\engine\bin\.cache\dev\editor\bundled\index.js:49156:38)
    at _Deserializer._deserializeArray (C:\ProgramData\cocos\editors\Creator\3.8.3\resources\resources\3d\engine\bin\.cache\dev\editor\bundled\index.js:49017:40)
    at _Deserializer._deserializeObject (C:\ProgramData\cocos\editors\Creator\3.8.3\resources\resources\3d\engine\bin\.cache\dev\editor\bundled\index.js:48995:29)

Step to reproduce:

  • clone the cocos branch
  • npm install
  • npm run --workspace=@ton/cocos-sdk build
  • cd ./packages/cocos && npm link
  • in the game example run npm link @ton/cocos-sdk
  • try to run the game example

I picked the setup from PR #4 as well. To test it:

  • npm run --workspace=@ton/cocos-sdk build:webpack
  • change index, module, types in package.json
  • try to run the game example

I suspect the issue maybe related to npm link differences from how the real build happens

@CocosTechLabs
Copy link

Hi, I made some changes, fixed this error, and tested it in flappy game.

Once this package is uploaded to npm repository, I will update the dependencies in flappy game

#6

@barinbritva barinbritva merged commit 54c0088 into main Jul 8, 2024
1 check passed
@barinbritva barinbritva deleted the cocos branch July 8, 2024 07:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants