Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

137
Views
No se puede usar la declaración de importación fuera de un módulo aunque el tipo es módulo

Estoy usando el estilo ES6 y quiero ser consistente al usar la importación desde ES6.

Aquí está mi archivo de prueba de broma que estoy configurando:

 import Get from './Get' test('Some test', async () => { expect(true).toBe(true) })

Y aquí está mi archivo Get:

 import cli from "commander"; import get from "./myHandler.js" const GET = () => { // Doing some stuff here... } export default GET

sigo recibiendo:

 C:\...\GET\get.test.js:2 import Get from './Get'; ^^^^^^ SyntaxError: Cannot use import statement outside a module at Runtime.createScriptFromCode (node_modules/jest-runtime/build/index.js:1773:14)

Y ya he agregado "type": "module", en mi paquete.json como lo sugieren este y otros. ¿Qué estoy haciendo mal aquí?

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!