From ab1ee0613a09b03a27d32624fddb18fa1ccffbb6 Mon Sep 17 00:00:00 2001 From: Nikita Karamov Date: Fri, 26 Jun 2020 17:17:49 +0200 Subject: [PATCH] Add ESM build --- package.json | 4 +++- rollup.config.js | 5 +++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index 7198131..eb405aa 100644 --- a/package.json +++ b/package.json @@ -22,9 +22,11 @@ "url": "https://karamoff.dev" }, "main": "./dist/shareon.cjs", + "module": "./dist/shareon.mjs", "unpkg": "./dist/shareon.min.js", "exports": { - "require": "./dist/shareon.cjs" + "require": "./dist/shareon.cjs", + "import": "./dist/shareon.mjs" }, "files": [ "dist" diff --git a/rollup.config.js b/rollup.config.js index b25e5fe..8407c13 100644 --- a/rollup.config.js +++ b/rollup.config.js @@ -70,6 +70,11 @@ if (isDev) { format: 'cjs', file: `${outputDir}${pkg.name}.cjs`, }); + output.push({ + name: pkg.name, + format: 'esm', + file: `${outputDir}${pkg.name}.mjs`, + }); output.push({ name: pkg.name, format: 'iife',