emailjs-com/emailjs-sdk

Error: SyntaxError: Cannot use import statement outside a module

AmanKuvera-Dev opened this issue · 1 comments

import { init } from './methods/init/init';
^^^^^^

SyntaxError: Cannot use import statement outside a module
at Object.compileFunction (node:vm:355:18)
at wrapSafe (node:internal/modules/cjs/loader:1039:15)
at Module._compile (node:internal/modules/cjs/loader:1073:27)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1138:10)
at Module.load (node:internal/modules/cjs/loader:989:32)
at Function.Module._load (node:internal/modules/cjs/loader:829:14)
at Module.require (node:internal/modules/cjs/loader:1013:19)
at require (node:internal/modules/cjs/helpers:93:18)

Screenshot (955)

The above error has been popping up ever since I've added the emailjs-com package to the project for a contact form.

  • The framework used: Next.js
  • The package manager used: yarn(initially), tried npm as well.
  • Tried adding "type": "module" in the package.json file as well.
  • Tried reinstalling the package multiple time as well.

The only scenario that it works right: When the app is up and running without the emailjs-com package and then when the package is installed while the localhost is running, but, this error pops up as soon as the page is refreshed.

Hello. Thank you for your participation
It's duplicate #17