Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

453
Vistas
Use Hardhat ES5 junto con Sveltekit ES6

Me gustaría usar Sveltekit junto con el casco, pero el casco usa la sintaxis commonjs require , si npx hardhat test con el final de js , obtengo el error:

 Error [ERR_REQUIRE_ESM]: require() of ES Module hardhat.config.js from node_modules\hardhat\internal\core\config\config-loading.js not supported. hardhat.config.js is treated as an ES module file as it is a .js file whose nearest parent package.json contains "type": "module" which declares all .js files in that package scope as ES modules. Instead rename hardhat.config.js to end in .cjs, change the requiring code to use dynamic import() which is available in all CommonJS modules, or change "type": "module" to "type": "commonjs" in package.json to treat all .js files as CommonJS (using .mjs for all ES modules instead).

Si cambio a type: commonjs , aparece este error si ejecuto npm run dev :

 Warning: To load an ES module, set "type": "module" in the package.json or use the .mjs extension. (Use `node --trace-warnings ...` to show where the warning was created) svelte.config.js:1 import preprocess from "svelte-preprocess"; ^^^^^^ SyntaxError: Cannot use import statement outside a module

Si cambio svelte.config.js a svelte.config.mjs , aparece el siguiente error: You need to create a svelte.config.js file y si cambio el nombre hardhat.config.js , hardhat no encuentra la configuración y quiere crear un nuevo proyecto.

¿Hay alguna forma de combinar estos dos aunque haya una combinación de declaraciones de import y de require ?

about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda