diff --git a/demo/index.html b/demo/index.html index 53de80e..64959eb 100644 --- a/demo/index.html +++ b/demo/index.html @@ -132,17 +132,17 @@ diff --git a/package.json b/package.json index 493fe43..09ec68c 100644 --- a/package.json +++ b/package.json @@ -5,6 +5,7 @@ "author": "g-harel", "license": "MIT", "main": "index.js", + "module": "index.module.js", "types": "index.d.ts", "scripts": { "prepack": "npm run build", diff --git a/rollup.config.js b/rollup.config.js index 70ea8e2..e3fcfe3 100644 --- a/rollup.config.js +++ b/rollup.config.js @@ -29,21 +29,23 @@ const bundles = [ }, ]; -export default bundles.map((bundle) => ({ - input: bundle.entry, - output: { - file: bundle.output + "/index.js", - format: "umd", - name: bundle.name, - sourcemap: true, - }, - plugins: [ - typescript({cacheRoot: "./node_modules/.cache/rpt2"}), - uglify(), - copy({ - hook: "writeBundle", - targets: [{src: bundle.types, dest: bundle.output, rename: "index.d.ts"}], - verbose: true, - }), - ], -})); +export default ["es", "umd"].flatMap((format) => + bundles.map((bundle) => ({ + input: bundle.entry, + output: { + file: bundle.output + `/index${format == "es" ? ".module" : ""}.js`, + format: format, + name: bundle.name, + sourcemap: true, + }, + plugins: [ + typescript({cacheRoot: "./node_modules/.cache/rpt2"}), + uglify(), + copy({ + hook: "writeBundle", + targets: [{src: bundle.types, dest: bundle.output, rename: "index.d.ts"}], + verbose: true, + }), + ], + })), +);