You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+9-3Lines changed: 9 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -955,9 +955,9 @@ enum-plus is designed to be compatible with a wide range of environments, includ
955
955
956
956
### Browser Environments
957
957
958
-
- **Modern Bundlers**: For bundlers supporting the [exports](https://nodejs.org/api/packages.html#exports-sugar) field (such as webpack 5+, vite, rollup), `es` directory is imported, which targets `ES2020`. If you need to support earlier browsers, you can use `@babel/preset-env` to transpile to earlier syntax during the build process.
958
+
- **Modern Bundlers**: For bundlers supporting the [exports](https://nodejs.org/api/packages.html#exports-sugar) configuration (such as webpack 5+, vite, rollup), `es` directory is imported, which targets `ES2020`. If you need to support earlier browsers, you can use `@babel/preset-env` to transpile to earlier syntax during the build process.
959
959
960
-
- **Legacy Bundlers**: For bundlers without [exports](https://nodejs.org/api/packages.html#exports-sugar) field support (like Webpack 4), this library automatically falls back to the `main` field entry point, and `es-legacy` directory is imported, which targets `ES2015`.
960
+
- **Legacy Bundlers**: For bundlers without [exports](https://nodejs.org/api/packages.html#exports-sugar) configuration support (like Webpack 4), this library automatically falls back to the `main` field entry point, and `es-legacy` directory is imported, which targets `ES2015`.
961
961
962
962
- **UMD Version**: For direct browser usage or static projects without bundlers, enum-plus provides UMD format files in the `umd` directory. These can be included via a `<script>` tag and accessed through `window.EnumPlus`. The UMD directory offers two versions:
963
963
@@ -972,7 +972,13 @@ enum-plus is designed to be compatible with a wide range of environments, includ
972
972
973
973
### **Node.js Environments**
974
974
975
-
In Node.js environments, the default import path is the `lib` directory, which targets **`ES2016`**. This is compatible with Node.js `v7.x` and above.
975
+
In Node.js environments, the EcmaScript version provided is **`ES2016`**.
976
+
977
+
Additionally, enum-plus supports both `CommonJS` and `ESModule` module formats.
978
+
979
+
- For versions that support the [exports](https://nodejs.org/api/packages.html#exports-sugar) configuration (e.g., Node 14+), you can choose to use either `require` or `import` syntax to import the module.
980
+
- For earlier Node.js versions, the default import is from the `lib` directory, which only supports the `CommonJS` module format, meaning you can only use the `require` syntax.
981
+
- The minimum compatible version of Node.js is `v7.x`.
0 commit comments