Skip to content

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

Open
@delphickaran

Description

@delphickaran

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;
`

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions