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 ?