Linked Questions
14 questions linked to/from "Cannot use import statement outside a module" error when importing react-hook-mousetrap in Next.js
1
vote
1
answer
2k
views
How to transform import syntax from node_modules with Babel in a NextJS application? [duplicate]
when transpiling es6 modules from my node_modules with Babel my build breaks with the following error:
SyntaxError: Cannot use import statement outside a module
at wrapSafe (internal/modules/cjs/...
1
vote
0
answers
353
views
SyntaxError: Cannot use import statement outside a module nextjs Vercel [duplicate]
Hi I need some help with deploying my nextjs project to Vercel
I am using emails-com to create a contact that work perfectly locally but I get a build fail on Vercel
When I import emailjs-com like ...
1
vote
0
answers
108
views
How can I use emailjs with NextJS correctly? [duplicate]
I am trying to use emailjs in my NextJS application to which you can find the repo here. When I deploy the application to Vercel, it throws an error saying I cannot use an import statement outside a ...
1
vote
0
answers
90
views
I get an error when importing a function in nextjs [duplicate]
I am using react-st-modal library to display modals and I am getting an error while importing a function from this library.
My import statement is:
const CustomDialogPromise = import("react-st-...
1
vote
0
answers
60
views
ReactJS/NextJS - npm run build fails - SyntaxError: Unexpected token 'export' [duplicate]
When running "npm run build" I'm getting the following error:
> Build error occurred
C:\Users\...\project\nextjs-frontend\node_modules\mui-rte\index.js:1
export {default} from './dist/...
7
votes
5
answers
7k
views
How to implement Tawk.to widget in a Next.JS website?
I have tried what is written on their @tawk.to/tawk-messenger-react plugin docs?
I have made a component like /components/Chat.js
import TawkMessengerReact from "@tawk.to/tawk-messenger-react&...
8
votes
1
answer
2k
views
Getting SyntaxError when using lightweight-charts in NextJS
I'm trying to use the lightweight-charts package in my nextjs project, however when i try to call the createChart function I get this error in my nodejs console.
...\lightweight-charts\dist\...
2
votes
1
answer
5k
views
SyntaxError: Cannot use import statement outside a module in nextjs
I'm using "react-d3-speedometer" library but getting the above error while importing. can anyone help with this?
2
votes
1
answer
3k
views
Next.js seemingly erroneous message "SyntaxError: Cannot use import statement outside a module"
Scenario
I'm working on a group project and one of the project maintainers understandably wants to use Next.js. We are using three.js in the project and while leveraging the GLTFLoader I've run into ...
1
vote
0
answers
4k
views
Next js: Cannot use import statement outside a module
I'm trying to use 'hover-effect' library in my next js application. However, I'm getting these error:
Server Error => SyntaxError: Cannot use import statement outside a module (/node_modules/gsap/...
1
vote
1
answer
332
views
How to solve SyntaxError: Cannot use import implementing Magic with NextJS in a Typescript setup?
Trying to implement Magic in NextJS using TypeScript.
Following this example/tutorial, which uses JS not TS: https://github.com/magiclabs/example-nextjs
Problem: when importing Magic like so
import { ...
1
vote
0
answers
437
views
import a file in project root from node_modules
Im developing a package from NextJs framework. This package has a middleware handler for API endpoints. So choosing which middlewares to be executed needs to be determined by developer outside the ...
0
votes
0
answers
50
views
Cannot import outside the module
Recently I've developed a react package that can be downloaded from npm with the following command
npm i react-secuuth
which has dependency package which can be downloaded from npm with the command
...
1
vote
0
answers
47
views
Trying to convert react application to next application
Keep getting error
SyntaxError: Cannot use import statement outside a module
cyberoni_next\node_modules\three\examples\jsm\lines\LineGeometry.js:2
import { LineSegmentsGeometry } from "../lines/...