About 2,320,000 results
Open links in new tab
  1. How to unit test 'private' utility function in nodejs

    javascript node.js unit-testing commonjs edited Jun 25, 2013 at 20:53 Mike Fielden 10.2k 14 62 101

  2. Alternative for __dirname in Node.js when using ES6 modules

    I use the flag --experimental-modules when running my Node application in order to use ES6 modules. However when I use this flag the metavariable __dirname is not available. Is there …

  3. typescript - Using import for an ESM Module in nest.js gives [ERR ...

    Aug 19, 2022 · 2 I believe you should stay with CJS in your app, and use the import() expression to load that ESM-only package. See: Compile a package that depends on ESM only library …

  4. CommonJS vs ES Modules for Express Node - Stack Overflow

    Sep 17, 2023 · Could anyone explain what is the best approach for node express app: CommonJS or ES Modules as of today? In the official documentation it shows that CommonJS …

  5. typescript - "npx prisma db seed" command got Error: Command …

    Nov 2, 2022 · "npx prisma db seed" command got Error: Command failed with exit code 1: ts-node --compiler-options {"module":"CommonJS"} prisma/seed.ts Asked 3 years ago Modified …

  6. javascript - Inquirer on node.js - Stack Overflow

    Jun 30, 2022 · Instead change the require of inquirer.js in D:\Cursos\nodeudemy\aulas\2_FUNDAMENTOS\10_abstracao_input\index.js to a dynamic …

  7. How can I publish an NPM module with both commonjs and es6 …

    To support both CommonJS require and ES6 import...from you don't need "a bundler like webpack or rollup in combination with babel". Provide separate entry-point (aka "main") scripts …

  8. Problem with loading "ES module" when importing in node js

    Jan 24, 2022 · The file extension (.mjs or .cjs) can force a module type or the "type": xxx in package.json can force a type. By default, with neither of those in place nodejs assumes your …

  9. Unable to import ESM module in Nestjs - Stack Overflow

    Dec 16, 2022 · ES Modules can import CommonJS modules CommonJS modules cannot import ES Modules synchronously NestJS does currently not support to compile to ESM - see this PR …

  10. How to use ES6 modules in CommonJS? - Stack Overflow

    Dec 17, 2021 · ESModules and CommonJS are mutually exclusive, so you can't "use ES6 modules inside CommonJS". However, in a way, you can "use CommonJS inside …