{"_id":"@miherlosev/esm","_rev":"1759633","name":"@miherlosev/esm","description":"Tomorrow's ECMAScript modules today!","dist-tags":{"latest":"3.2.26"},"maintainers":[{"name":"miherlosev","email":"mlosev86@gmail.com"}],"time":{"modified":"2026-11-23T09:12:25.000Z","created":"2021-10-12T18:27:42.297Z","3.2.26":"2021-10-12T18:27:42.297Z"},"users":{},"author":{"name":"John-David Dalton","email":"john.david.dalton@gmail.com"},"repository":{"url":"git+https://github.com/miherlosev/esm.git","type":"git"},"versions":{"3.2.26":{"name":"@miherlosev/esm","version":"3.2.26","keywords":["commonjs","ecmascript","export","import","modules","node","require"],"author":{"name":"John-David Dalton","email":"john.david.dalton@gmail.com"},"license":"MIT","_id":"@miherlosev/esm@3.2.26","maintainers":[{"name":"miherlosev","email":"mlosev86@gmail.com"}],"homepage":"https://github.com/miherlosev/esm#readme","bugs":{"url":"https://github.com/miherlosev/esm/issues"},"dist":{"shasum":"a516b35d8b8b4eac29598f1c2c23e30a4d260200","tarball":"http://registry-npm.ywwl.com/@miherlosev/esm/download/@miherlosev/esm-3.2.26.tgz","fileCount":6,"integrity":"sha512-TaW4jTGVE1/ln2VGFChnheMh589QCAZy1MVnLvjjSzZ4pEAa4WYAWPwFkDVZbSdPQdLfZy7LuTyZjWRkhX9/Gg==","signatures":[{"sig":"MEQCICzY4PltMbd2zpP8W8ppGhXQs+rA2nAsrtyDIZQgXQYpAiBQwa17dyRXPRBsq99qXrq11KTKZTUD1w4N24gR1m92HQ==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":307027,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJh2RiTCRA9TVsSAnZWagAA/KMP/iP2eg3hiXYsqTiJvCdI\nT6hCfcFJ9qs7TDoROGbSdybCfeyIKZmrwcDAhoCuWN1RgLVfYhlRbIZtFKjm\nCRkUXE4vvkMh+j+/HG1EPDd4fy1MXwrmL9AU7V5xwJ4hCAEqe8p1ipUlOxY3\nlaO7mzinLjGyBW1nQbS3hnmbz7prxSpGIMFbIou7YJIDtzoZlcuZHvloZudI\nflp0jrliIWQgfWuOgTIFmJHu/ddrnlxfTc2RMkFsq8FEN2fVZAnx94w8ESYk\nares3/4mD79N6DJlHeOr/18YgAifbEwCGLKYg1p5Cs+S9W+SGMRebBN1CFOY\nkr3h6C4/X6dsaLVHhGzaDjdq7jZoNoNFwO5MqYr0fOeaS897TgG3595JcO0d\nxJuTN97n+S5yU8q+j7dYsGgntdi9cqGtySNsF7w1+Ad2oWfLFhKmt+zC9YSU\nhx4Tb7dDn41+/h+JWwiHmmSSdzX2Bfbm07WMYN2syicA1ACwelMvHy/swGT+\neq7evIVlLVJjNjFCc7wj/0C6JR+FImmtW3B4UoTRC7f4TO6Ex2SLyJEsWWqw\nlfFU93zFKzv38BZvQYcwC4eB5AVlaAPEwWuakXGsn3Wmdd9MZ4AhuqPPhtN1\n13PB/7zDZH+XIN05p2rTfLgmNDdztEkwRLCOTDqw5sHCyXmsdzS45f8RJbXh\nqkMO\r\n=rO6C\r\n-----END PGP SIGNATURE-----\r\n","size":91223,"noattachment":false,"key":"/@miherlosev/esm/-/@miherlosev/esm-3.2.26.tgz"},"main":"esm.js","engines":{"node":">=6"},"gitHead":"511d672ae13e8bee13ba19bd7fdc2a3206c9d7d7","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"_npmUser":{"name":"miherlosev","email":"mlosev86@gmail.com"},"deprecated":"The @miherlosev/esm package is deprecated and will no longer receive updates.","repository":{"url":"git+https://github.com/miherlosev/esm.git","type":"git"},"_npmVersion":"6.14.15","description":"Tomorrow's ECMAScript modules today!","directories":{},"_nodeVersion":"14.17.6","runkitExample":"require = require(\"esm\")(module)\nrequire(\"lodash-es\")","_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/esm_3.2.26_1634063262100_0.8594914910228095","host":"s3://npm-registry-packages"},"publish_time":1634063262297,"_cnpm_publish_time":1634063262297}},"readme":"# esm\r\n\r\nThe brilliantly simple, babel-less, bundle-less ECMAScript module loader.\r\n\r\n> `esm` is the world’s most advanced ECMAScript module loader.\r\nThis fast, production ready, zero dependency loader is all you need to support\r\nECMAScript modules in Node 6+. See the release [post](https://medium.com/web-on-the-edge/tomorrows-es-modules-today-c53d29ac448c)\r\nand [video](https://www.youtube.com/watch?v=JcZ-FzfDq8A#t=5) for details!\r\n\r\nInstall\r\n---\r\n\r\n* __New projects__\r\n\r\n  Run `npm init esm` or `yarn create esm`.\r\n\r\n  :bulb: Use the `-y` flag to answer “yes” to all prompts.\r\n\r\n* __Existing projects__\r\n\r\n  Run `npm i esm` or `yarn add esm`.\r\n\r\nGetting started\r\n---\r\n\r\nThere are two ways to enable `esm`.\r\n\r\n1. Enable `esm` for packages:\r\n\r\n   Use `esm` to load the main ES module and export it as CommonJS.\r\n\r\n    __index.js__\r\n    ```js\r\n    // Set options as a parameter, environment variable, or rc file.\r\n    require = require(\"esm\")(module/*, options*/)\r\n    module.exports = require(\"./main.js\")\r\n    ```\r\n    __main.js__\r\n    ```js\r\n    // ESM syntax is supported.\r\n    export {}\r\n    ```\r\n    :bulb: These files are automagically created with `npm init esm` or `yarn create esm`.\r\n\r\n2. Enable `esm` for local runs:\r\n\r\n    ```shell\r\n    node -r esm main.js\r\n    ```\r\n    :bulb: Omit the filename to enable `esm` in the REPL.\r\n\r\nFeatures\r\n---\r\n\r\n:clap: By default, :100: percent CJS interoperability is enabled so you can get stuff done.<br>\r\n:lock: `.mjs` files are limited to basic functionality without support for `esm` options.\r\n\r\nOut of the box `esm` just works, no configuration necessary, and supports:\r\n\r\n* Passing all applicable [test262](https://github.com/tc39/test262) compliance tests\r\n* [`import`](https://ponyfoo.com/articles/es6-modules-in-depth#import)/[`export`](https://ponyfoo.com/articles/es6-modules-in-depth#export)\r\n* [`import.meta`](https://github.com/tc39/proposal-import-meta)\r\n* [Dynamic `import`](https://github.com/tc39/proposal-dynamic-import)\r\n* [Live bindings](https://ponyfoo.com/articles/es6-modules-in-depth#bindings-not-values)\r\n* [File URI scheme](https://en.wikipedia.org/wiki/File_URI_scheme)\r\n* Node `stdin`, [`--eval`](https://nodejs.org/api/cli.html#cli_e_eval_script), [`--print`](https://nodejs.org/api/cli.html#cli_p_print_script) flags\r\n* Node [`--check`](https://nodejs.org/api/cli.html#cli_c_check) flag _(Node 10+)_\r\n\r\nOptions\r\n---\r\n\r\nSpecify options with one of the following:\r\n\r\n* `\"esm\"` field in `package.json`\r\n* CJS/ESM in an `.esmrc.js`, `.esmrc.cjs`, or `.esmrc.mjs` file\r\n* [JSON6](https://github.com/d3x0r/json6) in an `.esmrc` or `.esmrc.json` file\r\n* JSON6 or file path in the `ESM_OPTIONS` environment variable\r\n* `ESM_DISABLE_CACHE` environment variable\r\n\r\n<table><tr><td colspan=2><code>{</code><tr><td valign=top><code>\"cjs\":true</code><td><p>A boolean or object for toggling CJS features in ESM.<details><summary>Features</summary><table><tr><td colspan=2><code>{</code><tr><td valign=top><code>\"cache\":true</code><td><p>A boolean for storing ES modules in <code>require.cache</code>.<tr><td valign=top><code>\"esModule\":true</code><td><p>A boolean for <code>__esModule</code> interoperability.<tr><td valign=top><code>\"extensions\":true</code><td><p>A boolean for respecting <code>require.extensions</code> in ESM.<tr><td valign=top><code>\"mutableNamespace\":true</code><td><p>A boolean for mutable <a href=https://ponyfoo.com/articles/es6-modules-in-depth#import-all-the-things>namespace objects</a>.<tr><td valign=top><code>\"namedExports\":true</code><td><p>A boolean for <a href=https://ponyfoo.com/articles/es6-modules-in-depth#importing-named-exports>importing named exports</a> of CJS modules.<tr><td valign=top><code>\"paths\":true</code><td><p>A boolean for following CJS <a href=https://github.com/nodejs/node-eps/blob/master/002-es-modules.md#432-removal-of-non-local-dependencies>path rules</a> in ESM.<tr><td valign=top><code>\"vars\":true</code><td><p>A boolean for <code>__dirname</code>, <code>__filename</code>, and <code>require</code> in ESM.<tr><td valign=top><code>\"dedefault\":false</code><td><p>A boolean for requiring ES modules without the dangling <code>require().default</code>.<tr><td valign=top><code>\"topLevelReturn\":false</code><td><p>A boolean for top-level <code>return</code> support.<tr><td colspan=2><code>}</code></table></details><tr><td valign=top><code>\"mainFields\":[\"main\"]</code><td><p>An array of fields checked when importing a package.<tr><td valign=top><code>\"mode\":\"auto\"</code><td><p>A string mode:<ul><li><code>\"auto\"</code> detect files with <code>import</code>, <code>import.meta</code>, <code>export</code>,<br><a href=https://github.com/tc39/proposal-modules-pragma><code>\"use module\"</code></a>, or <code>.mjs</code> as ESM.<li><code>\"all\"</code> files besides those with <code>\"use script\"</code> or <code>.cjs</code> are treated as ESM.<li><code>\"strict\"</code> to treat <strong>only</strong> <code>.mjs</code> files as ESM.</ul><tr><td valign=top><code>\"await\":false</code><td><p>A boolean for <a href=https://github.com/tc39/proposal-top-level-await>top-level <code>await</code></a> in modules without ESM exports. <em>(Node 10+)</em><tr><td valign=top><code>\"force\":false</code><td><p>A boolean to apply these options to all module loads.<tr><td valign=top><code>\"wasm\":false</code><td><p>A boolean for <a href=https://nodejs.org/api/globals.html#globals_webassembly>WebAssembly</a> module support. <em>(Node 8+)</em><tr><td colspan=2><code>}</code></table>\r\n\r\nDevOpts\r\n---\r\n\r\n<table><tr><td colspan=2><code>{</code><tr><td valign=top><code>\"cache\":true</code><td><p>A boolean for toggling cache creation or a cache directory path.<tr><td valign=top><code>\"sourceMap\":false</code><td><p>A boolean for including inline source maps.<tr><td colspan=2><code>}</code></table>\r\n\r\nTips\r\n---\r\n\r\n### Bundling\r\n\r\n* For bundlers like [`browserify`](http://browserify.org/)+[`esmify`](https://github.com/mattdesl/esmify),\r\n  [`parcel-bundler`](https://parceljs.org/), and [`webpack`](https://webpack.js.org/)\r\n  add a `\"module\"` field to `package.json` pointing to the main ES module.\r\n  ```json\r\n  \"main\": \"index.js\",\r\n  \"module\": \"main.js\"\r\n  ```\r\n\r\n  :bulb: This is automagically done with `npm init esm` or `yarn create esm`.\r\n\r\n### Extensions\r\n\r\n* Enable `esm` for [`wallaby.js`](https://wallabyjs.com/) following their\r\n  [integration example](https://wallabyjs.com/docs/integration/node.html#es-modules).\r\n\r\n### Loading\r\n\r\n* Load `esm` before loaders/monitors like\r\n  [`@babel/register`](https://babeljs.io/docs/en/next/babel-register.html),\r\n  [`newrelic`](https://github.com/newrelic/node-newrelic),\r\n  [`sqreen`](https://docs.sqreen.io/sqreen-for-nodejs/getting-started-2/), and\r\n  [`ts-node`](https://github.com/TypeStrong/ts-node#programmatic).\r\n\r\n* Load `esm` for [`jasmine`](https://jasmine.github.io/) using the\r\n  [`\"helpers\"`](https://jasmine.github.io/setup/nodejs.html#configuration)\r\n  field in `jasmine.json`:\r\n  ```json\r\n  \"helpers\": [\r\n    \"node_modules/esm\"\r\n  ]\r\n  ```\r\n\r\n* Load `esm` with “node-args\" options of:<br>\r\n  - [`pm2`](https://pm2.io/doc/en/runtime/reference/pm2-cli/#pm2-flags): `--node-args=\"-r esm\"`\r\n\r\n* Load `esm` with “require” options of\r\n  [`ava`](https://github.com/avajs/ava/blob/master/docs/recipes/es-modules.md),\r\n  [`mocha`](https://mochajs.org/#-require-module-r-module),\r\n  [`nodemon`](https://nodemon.io/),\r\n  [`nyc`](https://github.com/istanbuljs/nyc#require-additional-modules),\r\n  [`qunit`](https://github.com/qunitjs/qunit/releases/tag/2.6.0),\r\n  [`tape`](https://github.com/substack/tape#preloading-modules), and\r\n  [`webpack`](https://webpack.js.org/api/cli/#config-options).\r\n\r\n  :bulb: Builtin `require` cannot sideload `.mjs` files. However, `.js` files\r\n  can be sideloaded or `.mjs` files may be loaded with dynamic `import`.\r\n","_attachments":{},"homepage":"https://github.com/miherlosev/esm#readme","bugs":{"url":"https://github.com/miherlosev/esm/issues"},"license":"MIT"}