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()], },