From 2cbb3ec036c9dade199a56adc520c2f9cf35aeed Mon Sep 17 00:00:00 2001 From: Vitor Luiz Cavalcanti Date: Thu, 24 Feb 2022 17:03:46 -0300 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=A7=20add=20support=20to=20NodeJS=20ES?= =?UTF-8?q?M?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 1 + package.json | 10 ++++++++++ rollup.config.js | 8 ++++++++ 3 files changed, 19 insertions(+) diff --git a/README.md b/README.md index 2b96d72..227383e 100644 --- a/README.md +++ b/README.md @@ -8,6 +8,7 @@ Provides a simple API to normalize texts, white-spaces, names, paragraphs & diacritics (accents). - 📦 Distributions in ESM, CommonJS, UMD and UMD _minified_ formats. + - Supports NodeJS ESM and CommonJS; - ⚡ Lightweight: - It's bundled with [Rollup](https://rollupjs.org/) and [Bublé](https://buble.surge.sh/). diff --git a/package.json b/package.json index 3d82c34..b8ea728 100644 --- a/package.json +++ b/package.json @@ -10,6 +10,16 @@ "module": "dist/index.esm.js", "jsdelivr": "dist/index.umd.min.js", "umd:main": "dist/index.umd.js", + "exports": { + ".": [ + { + "import": "./dist/index.mjs", + "require": "./dist/index.cjs", + "default": "./dist/index.js" + }, + "./dist/index.js" + ] + }, "scripts": { "test": "yarn run test:lint && yarn run test:transpile && yarn run test:unit", "test:transpile": "tsc --project ./tsconfig.test.json", diff --git a/rollup.config.js b/rollup.config.js index a8be2c6..b329d80 100644 --- a/rollup.config.js +++ b/rollup.config.js @@ -20,6 +20,14 @@ const options = [ format: 'esm', file: './dist/index.esm.js', }), + getOutputOption({ + format: 'commonjs', + file: './dist/index.cjs', + }), + getOutputOption({ + format: 'esm', + file: './dist/index.mjs', + }), ], }, {