Skip to content

Commit

Permalink
build: use preserveModules for esm build
Browse files Browse the repository at this point in the history
  • Loading branch information
velut committed Jan 7, 2021
1 parent 595b232 commit 82a4109
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
14 changes: 14 additions & 0 deletions tsdx.config.js
Original file line number Diff line number Diff line change
@@ -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;
},
};

0 comments on commit 82a4109

Please sign in to comment.