About 10,700,000 results
Open links in new tab
  1. How To Use An ES6 Import In Node.js? - GeeksforGeeks

    Jan 7, 2025 · To use an ES6 import in Node.js, you need to make some configurations to support ES6 modules. While Node.js was originally built around the CommonJS module system …

  2. How can I use an ES6 import in Node.js? - Stack Overflow

    Nodejs v13 requires to have package.json somewhere in current or parent directory and {"type": "module"} in it and you can use ES6 imports. From doc: Files ending with .js or lacking any …

  3. Using `import` Statements in Node.js - Mastering JS

    Jun 24, 2020 · Node has limited support for ES6 import statements. Here's how you can make JavaScript that uses `import` work in Node.

  4. Usingimport” instead of “require” in Node.js - Medium

    Apr 25, 2024 · Migrating from “require” to “import” in a Node.js project can lead to cleaner, more modular code that aligns with modern JavaScript standards. By enabling ECMAScript Modules …

  5. Node.js: How to UseImport” and “Require” in the Same File

    Dec 2, 2023 · This article shows you how to enable ES6 import/export in Node.js and use both require and import in the same file.

  6. How to Use "import" in Node.js? - Designcise

    Oct 3, 2021 · After adding the "type": "module" directive, you should be able to use import in your code. Please note that the "type" field not only applies to initial entry points (e.g. node app.js) …

  7. require vs import in NodeJs - DEV Community

    Oct 7, 2022 · require is used to import modules in CommonJS while import is used in ES Modules. Since require and import are just small parts of two different module systems, it …

  8. How to use the “import” statement in Node.js - JavaScript in …

    Jan 18, 2022 · But if you want to use the “import” statement in your Node.js code instead of the “require” keyword, then there is a solution available. The first method to use the “import” …

  9. ‘require’ vs ‘importin Node.js. One of the first concepts you’ll ...

    Oct 9, 2023 · In summary, require and import are two ways to include modules in Node.js, each with its own advantages and use cases. The choice between them often depends on your …

  10. Using Node.js require vs. ES6 import/export - Stack Overflow

    Jul 11, 2015 · node --experimental-modules index.mjs lets you use import without Babel and works in Node 8.5.0+. You can (and should) also publish your npm packages as native …

  11. Some results have been removed
Refresh