-
-
Notifications
You must be signed in to change notification settings - Fork 75
Description
Whenever I import BlocklyWorkspace I get an error saying "SyntaxError: Cannot use import statement outside a module". I am using Next.js with create-next-app.
My code:
import styles from '../styles/Home.module.css'
import Head from 'next/head'
import Image from 'next/image'
import Script from 'next/script'
import React, { useState } from 'react';
import { BlocklyWorkspace } from 'react-blockly';
function BlocklyEditor() {
const [xml, setXml] = useState();
return (
<BlocklyWorkspace
className="width-100"
toolboxConfiguration={MY_TOOLBOX}
initialXml={xml}
onXmlChange={setXml}
/>
)
}
export default function Home() {
return (
<div className={styles.container}>
<Head>
<title>Studio</title>
<link rel="icon" href="/favicon.ico" />
</Head>
<main className={styles.main}>
<h1>Studio</h1>
<BlocklyEditor/>
</main>
</div>
)
}Call Stack
file:///Users/vadim/Documents/studio/node_modules/react-blockly/dist/index.js (1)wrapSafe
internal/modules/cjs/loader.js (988:16)
Module._compile
internal/modules/cjs/loader.js (1036:27)
Object.Module._extensions..js
internal/modules/cjs/loader.js (1101:10)
Module.load
internal/modules/cjs/loader.js (937:32)
Function.Module._load
internal/modules/cjs/loader.js (778:12)
Module.require
internal/modules/cjs/loader.js (961:19)
require
internal/modules/cjs/helpers.js (92:18)
Object.react-blockly
file:///Users/vadim/Documents/studio/.next/server/pages/index.js (174:18)
webpack_require
file:///Users/vadim/Documents/studio/.next/server/webpack-runtime.js (33:42)
eval
webpack-internal:///./pages/index.js (17:71)