5

I'm interested in creating a React web app that teaches kids how to use Python through programs such as Turtle graphics. I thought that Skulpt would be a good library to use since it already has a demo that shows here how to use it within a HTML page. However, while it loads fine in a normal web page, I'm having difficulty getting it to run in my React app, probably due to the global variables that skulpt.min.js sets. Specifically, I get the following message:

./src/utils/skulpt-stdlib.js
Line 1:1:  'Sk' is not defined  no-undef

I imagine it's because the skulpt-stdlib.js script relies on the skulpt.min.js script to be read first and set its global variables before the skulpt-stdlib.js script works. What would I need to do in React to get this to work the same way it does in a normal web page? Thank you!

MasterBirdy
  • 113
  • 1
  • 3
  • 4

1 Answers1

1

try this, hope this works, i am also trying, i will update this if it works completely.

add the below code in the beginning of skulpt.min.js

function Sk() {}

and the below code in the end of skulpt.min.js

export { Sk };