From 82a4109f159d12369ac1d1423ab6777a9eaa61f9 Mon Sep 17 00:00:00 2001 From: velut <12040076+velut@users.noreply.github.com> Date: Thu, 7 Jan 2021 21:03:29 +0100 Subject: [PATCH] build: use preserveModules for esm build See https://github.com/formium/tsdx/issues/276 --- package.json | 2 +- tsdx.config.js | 14 ++++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) create mode 100644 tsdx.config.js diff --git a/package.json b/package.json index a1057a7..fd222ce 100644 --- a/package.json +++ b/package.json @@ -6,7 +6,7 @@ "license": "MIT", "main": "dist/index.js", "typings": "dist/index.d.ts", - "module": "dist/query-registry.esm.js", + "module": "dist/index.esm.js", "sideEffects": false, "files": [ "dist", diff --git a/tsdx.config.js b/tsdx.config.js new file mode 100644 index 0000000..c8090cf --- /dev/null +++ b/tsdx.config.js @@ -0,0 +1,14 @@ +module.exports = { + rollup(config, opts) { + if (opts.format === 'esm') { + config = { ...config, preserveModules: true }; + config.output = { + ...config.output, + dir: 'dist/', + entryFileNames: '[name].esm.js', + }; + delete config.output.file; + } + return config; + }, +};