scalacenter/scastie

Uncaught SyntaxError: Identifier 'ScastiePlaygroundMain' has already been declared

faveoled opened this issue · 1 comments

Describe the bug

No response

Scastie snippet link

No response

To Reproduce

  1. Set Scala.js settings (scala 3.2.2, Scala.js compiler)
  2. Paste this snippet:
import scala.scalajs.js
import org.scalajs.dom.window.alert
import scala.scalajs.js.annotation.JSExportTopLevel

@JSExportTopLevel("A")
object A {
  var num = 3
}
A.num = 3
alert(A.num.toString)
  1. Click "Run". Alert appears.
  2. Click "Run". Alert does not appear. Error is in the console.
  3. Reload page. Alert appears again
  4. Click "Run". Alert does not appear. Error is in the console.
    ...

Expected behavior

Alert appears on each run

Screenshot ( Optional )

No response

Version

Scastie website

What browsers are you seeing the problem on?

Firefox, Chrome

Relevant log output

Uncaught SyntaxError: Identifier 'ScastiePlaygroundMain' has already been declared
    at app-5c87202c.js:46:161
    at __.apply__O (app-5c87202c.js:69:102125)
    at app-5c87202c.js:46:237
    at __.apply__O (app-5c87202c.js:69:102125)
    at rS.run__Ljapgolly_scalajs_react_callback_Trampoline__O (app-5c87202c.js:6:128410)
    at app-5c87202c.js:6:151016
    at Rr.apply__O__O__O__O__O (app-5c87202c.js:69:105236)
    at c.sr_ObjectRef__f_elem.<anonymous> (app-5c87202c.js:33:54453)
    at KH (vendor-d8f4de7f.js:98:1752)
    at eq (vendor-d8f4de7f.js:100:5031)
    at t.unstable_runWithPriority (vendor-d8f4de7f.js:85:3806)
    at oi (vendor-d8f4de7f.js:96:38475)
    at Gr (vendor-d8f4de7f.js:100:1810)
    at Og (vendor-d8f4de7f.js:98:11030)
    at vendor-d8f4de7f.js:96:38697
    at t.unstable_runWithPriority (vendor-d8f4de7f.js:85:3806)
    at oi (vendor-d8f4de7f.js:96:38475)
    at LD (vendor-d8f4de7f.js:96:38643)
    at wn (vendor-d8f4de7f.js:96:38578)
    at fr (vendor-d8f4de7f.js:98:8417)
    at Object.enqueueSetState (vendor-d8f4de7f.js:96:42559)
    at ba.setState (vendor-d8f4de7f.js:78:1371)
    at Br.modState__F1__F0__Ljapgolly_scalajs_react_util_Effect$Dispatch__V (app-5c87202c.js:118:98424)
    at Br.modState__F1__F0__Ljapgolly_scalajs_react_util_Effect$Dispatch__O (app-5c87202c.js:118:99670)
    at zr.modState__F1__F0__Ljapgolly_scalajs_react_util_Effect$Dispatch__V (app-5c87202c.js:118:105289)
    at zr.modState__F1__F0__Ljapgolly_scalajs_react_util_Effect$Dispatch__O (app-5c87202c.js:118:107072)
    at app-5c87202c.js:118:63999
    at __.apply__O (app-5c87202c.js:69:102125)
    at Bv (app-5c87202c.js:74:1273)
    at Gf.modState__F1__F0__Ljapgolly_scalajs_react_util_Effect$Dispatch__O (app-5c87202c.js:118:64271)
    at $t (app-5c87202c.js:59:98102)
    at ou.onMessage__Lcom_olegych_scastie_api_SnippetProgress__Z (app-5c87202c.js:43:13540)
    at ou.onMessage__O__Z (app-5c87202c.js:43:17766)
    at _f.onMessage__T__V (app-5c87202c.js:3:5879)
    at co_ (app-5c87202c.js:41:39334)
    at Lcom_olegych_scastie_client_EventSourceStream__f_eventSource.onmessage (app-5c87202c.js:43:740)

Also this warning follows:

Source map error: Error: JSON.parse: unexpected character at line 1 column 1 of the JSON data
Resource URL: null
Source Map URL: fastopt.js.map