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

SyntaxError CLIENT Cannot declare a function that shadows a let/const/class/function variable 'i'. build/node_modules/brisa/jsx-runtime/index.js::1:0 #520

Open
swiftcoder opened this issue Oct 6, 2024 · 4 comments
Assignees
Labels
bug Something isn't working

Comments

@swiftcoder
Copy link

I'm not entirely sure how I'm triggering this, but it seems to occur after adding/removing a web component. Once I'm in this situation, build and start work fine, but the dev command fails every page load with some variation on the following:

$ brisa dev
[ info ]   🚀 Brisa 0.1.0: Running on Bun.js 1.1.29
[ wait ]  starting the development server...
[ info ]   ✓   Compiled successfully!
[ info ]   compiled successfully in 753.64ms.
[ info ]   hot reloading enabled
[ info ]   listening on http://localhost:3000
[ error ]   Ops! Error:
[ error ]   --------------------------
[ error ]   SyntaxError: Cannot declare a function that shadows a let/const/class/function variable 'i'.
    at <parse> (/Users/tristam/projects/feersum-brisa/build/node_modules/brisa/jsx-runtime/index.js:2)
    at <anonymous> (:11:43)
    at processTicksAndRejections (:12:39)

Any pointers as to what I might be doing wrong? Is there a web-component cache I need to blow away?

@aralroca aralroca self-assigned this Oct 6, 2024
@aralroca aralroca added the bug Something isn't working label Oct 6, 2024
@aralroca
Copy link
Collaborator

aralroca commented Oct 6, 2024

@swiftcoder Does it happen to you from the beginning when you initialize a project or has it happened to you afterwards? If the latter, could you share some code?

And what platform is your computer?

  • For MacOS and Linux: copy the output of uname -mprs
  • For Windows: copy the output of "$([Environment]::OSVersion | ForEach-Object VersionString) $(if ([Environment]::Is64BitOperatingSystem) { "x64" } else { "x86" })" in the PowerShell console

@aralroca
Copy link
Collaborator

aralroca commented Oct 6, 2024

Maybe can be related with this Bun issue: oven-sh/bun#12176 (comment)

@swiftcoder
Copy link
Author

swiftcoder commented Oct 6, 2024

I figured out the issue eventually, by commenting out code till I isolated it. It looks like an incompatibility with trying to import from a library that does an export *

The easiest repro I have to hand is with THREE.js. If you add Three to your project and then try and import * as THREE from 'three'; or import { GLTFLoader } from "three/examples/jsm/Addons.js";, then brisa dev will choke.

Switching to the old require(...) syntax unbreaks it, as does importing inner modules (rather than the export * re-exports in the top-level files)

$ uname -mprs
Darwin 23.6.0 arm64 arm

@aralroca
Copy link
Collaborator

@swiftcoder this Bun issue is fixed in the latest version of Bun, can you check that it does not happen to you anymore? 🙏 Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants