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

BZ 0.2 broke JS compatibility #45

Open
rizen opened this issue Mar 26, 2024 · 3 comments
Open

BZ 0.2 broke JS compatibility #45

rizen opened this issue Mar 26, 2024 · 3 comments

Comments

@rizen
Copy link

rizen commented Mar 26, 2024

in 0.1 you could just rename all the .ts files in src/game to .js and all the .tsx files in src/ui to .jsx and everything worked. However, now in 0.2 it no longer works because it can't find game-interface.ts

err: ✘ [ERROR] Could not resolve "src/game/game-interface.ts"

/Users/jtsmith/boardzilla/sevenjs/node_modules/esbuild/lib/main.js:1651
  let error = new Error(text);
              ^

Error: Build failed with 1 error:
error: Could not resolve "src/game/game-interface.ts"
    at failureErrorWithLog (/Users/jtsmith/boardzilla/sevenjs/node_modules/esbuild/lib/main.js:1651:15)
    at /Users/jtsmith/boardzilla/sevenjs/node_modules/esbuild/lib/main.js:1059:25
    at runOnEndCallbacks (/Users/jtsmith/boardzilla/sevenjs/node_modules/esbuild/lib/main.js:1486:45)
    at buildResponseToResult (/Users/jtsmith/boardzilla/sevenjs/node_modules/esbuild/lib/main.js:1057:7)
    at /Users/jtsmith/boardzilla/sevenjs/node_modules/esbuild/lib/main.js:1086:16
    at responseCallbacks.<computed> (/Users/jtsmith/boardzilla/sevenjs/node_modules/esbuild/lib/main.js:704:9)
    at handleIncomingPacket (/Users/jtsmith/boardzilla/sevenjs/node_modules/esbuild/lib/main.js:764:9)
    at Socket.readFromStdout (/Users/jtsmith/boardzilla/sevenjs/node_modules/esbuild/lib/main.js:680:7)
    at Socket.emit (node:events:518:28)
    at addChunk (node:internal/streams/readable:559:12) {
  errors: [Getter/Setter],
  warnings: [Getter/Setter]
}

Node.js v20.11.0
@rizen
Copy link
Author

rizen commented Mar 26, 2024

Looks like this is due to an entryPoint in esbuild.game.mjs

@rizen
Copy link
Author

rizen commented Mar 26, 2024

Yup, changing that fixed it. So now I'm on to seeing if there is a different default the entry point could have, or if that just needs to be added to the cookbook.

@rizen
Copy link
Author

rizen commented Mar 26, 2024

Ok, spoke with Moxy about this and removing entryPoints worked for me as well as changing entryPoints to:

entryPoints: ['src/game/game-interface.js'],

Also worked for me.

But rather than documenting that, he would like to investigate something called allowJS which supposedly keeps the guardrails of Typescript working inside of JS.

Here's the start of that conversation in discord: https://discord.com/channels/@me/1186428321471402085/1222248673380012154

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

No branches or pull requests

1 participant