From 7bcb5cc7ea7ad8c51d2d367bbce52ffa0dd63f3e Mon Sep 17 00:00:00 2001 From: Hans-Wilhelm Warlo Date: Tue, 10 Mar 2020 20:05:55 +0100 Subject: [PATCH] Output es module --- package.json | 1 + rollup.config.js | 21 ++++++++++++++------- 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/package.json b/package.json index a794340a21a..33bb1aaedf4 100644 --- a/package.json +++ b/package.json @@ -6,6 +6,7 @@ "license": "MIT", "repository": "tannerlinsley/react-query", "main": "index.js", + "module": "dist/react-query.min.mjs", "sideEffects": false, "scripts": { "test": "is-ci \"test:ci\" \"test:dev\"", diff --git a/rollup.config.js b/rollup.config.js index 792e5bf8504..8cc2dd41883 100644 --- a/rollup.config.js +++ b/rollup.config.js @@ -23,13 +23,20 @@ export default [ }, { input: 'src/index.js', - output: { - name: 'ReactQuery', - file: 'dist/react-query.production.min.js', - format: 'umd', - sourcemap: true, - globals, - }, + output: [ + { + name: 'ReactQuery', + file: 'dist/react-query.production.min.js', + format: 'umd', + sourcemap: true, + globals, + }, + { + file: 'dist/react-query.min.mjs', + format: 'es', + sourcemap: true, + }, + ], external, plugins: [babel(), terser(), size()], },