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

I am trying to import scratch-gui in my project. Getting following exceptions. #9844

Open
delphickaran opened this issue Mar 12, 2025 · 0 comments

Comments

@delphickaran
Copy link

delphickaran commented Mar 12, 2025

fetch-worker.7a0adc94df277ffeb963.js:1 Uncaught SyntaxError: Unexpected token '<' (at fetch-worker.7a0adc94df277ffeb963.js:1:1)

My scratchEditor file looks like this:

`
import React, { useEffect, useState } from "react";
import { Provider, useSelector } from "react-redux";
import { IntlProvider } from "react-intl";
import { store, scratchGUI } from "../stores/store"; // Import store and scratchGUI

const ScratchApp = () => {
const [WrappedGUI, setWrappedGUI] = useState(null);

useEffect(() => {
// Only initialize scratch-gui if it's available
if (scratchGUI) {
const { AppStateHOC, default: GUI } = scratchGUI;

  if (AppStateHOC && GUI) {
    const Wrapped = AppStateHOC(GUI); // Wrap the GUI with AppStateHOC
    setWrappedGUI(() => Wrapped); // Set the wrapped GUI component
  }
}

}, []);

// If the GUI is not loaded yet, show a loading message
if (!WrappedGUI) {
return

Loading...
;
}

const locale = useSelector((state) => state.locales.locale || "en"); // Get locale from Redux state
const messages = useSelector((state) => state.locales.messages || {}); // Get messages from Redux state

return (

{" "}
{/* Provide the Redux store to the app /}

<div style={{ width: "100vw", height: "100vh" }}>
{/
Render the wrapped Scratch GUI */}



);
};

export default ScratchApp;
`

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