mui-nested-menu icon indicating copy to clipboard operation
mui-nested-menu copied to clipboard

SyntaxError: Cannot use import statement outside a module - Next js

Open Donivanes opened this issue 2 years ago • 14 comments

Hi, I'm having this issue with this library and I don't know how to fix it. I'm using Next js Sometimes it renders, but when you reload the error happens. Here is an example of the error: https://codesandbox.io/s/affectionate-easley-8by211?file=/pages/index.tsx

The terminal error:

import { createStyled, shouldForwardProp } from '@mui/system';
^^^^^^

SyntaxError: Cannot use import statement outside a module
    at wrapSafe (internal/modules/cjs/loader.js:1001:16)
    at Module._compile (internal/modules/cjs/loader.js:1049:27)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10)
    at Module.load (internal/modules/cjs/loader.js:950:32)
    at Function.Module._load (internal/modules/cjs/loader.js:790:12)
    at Module.require (internal/modules/cjs/loader.js:974:19)
    at require (internal/modules/cjs/helpers.js:101:18)
    at Object.<anonymous> (/sandbox/node_modules/mui-nested-menu/components/IconMenuItem.js:56:32)
    at Module._compile (internal/modules/cjs/loader.js:1085:14)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10)

Donivanes avatar Jul 26 '22 20:07 Donivanes