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

447
Views
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
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!