[BUG] Toggling code editor fails on current development build

Open Beginner friendly
#203 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
88/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
javascript, react
Domain
frontend

Research direction

Start in WickCodeEditor.jsx and inspect package.json, then reproduce the failure by running the development build and opening the code editor. Verify that the JavaScript worker loads from the configured public path and that toggling the editor completes without the importScripts console error.

Written by the indexing model from the issue text.

Description

bug

Describe the bug
If you start up a new dev server (or load up https://candlestickers.app/test/), and open the code editor, you get this console error:
Uncaught NetworkError: Failed to execute 'importScripts' on 'WorkerGlobalScope': The script at 'http://localhost:3000/static/js/worker-javascript.js' failed to load.
(anonymous) @ index.js:35
(anonymous) @ index.js:35
(anonymous) @ Editor.jsx:217
Editor.jsx:218 Error Details: {error: "Uncaught NetworkError: Failed to execute 'importSc…0/static/js/worker-javascript.js' failed to load.", url: 'blob:http://localhost:3000/16c863ac-f036-47c3-bdfc-cc44a9451e3b', line: 1}

note: line numbers may be a bit off, but Editor.jsx:217 is window.onerror = function (error, url, line) {/*...*/} in the constructor and index.js:35 is ReactDOM.render(\<Editor \/\>)

To reproduce
Steps to reproduce the behavior:

  1. Make sure you are running the test build
  2. Open the code editor
  3. See error in console

Expected behavior
Code editor toggles cleanly.

Editor version
Candlestick only, on the development branch

Device

  • Lenovo AIO Desktop
  • Windows 11
  • Microsoft Edge

Do you have a suggested solution to this issue?
I fixed it in my Rolldown migration PR by doing: ace.config.set('basePath', import.meta.env.VITE_PUBLIC_URL + 'ace-workers/'); in WickCodeEditor.jsx and also adding "copy-ace-workers": "shx mkdir -p public/ace-workers && shx cp node_modules/ace-builds/src-noconflict/worker-javascript.js public/ace-workers/worker-javascript.js" as a script in package.json

Dominant language
JavaScript
Stars
51
Forks
20
Avg merge
14d 12h
Merged PRs (30d)
3

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from Candlestickers/Candlestick

All issues in Candlestickers/Candlestick

Similar issues

More JavaScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.