diff --git a/CHANGELOG.md b/CHANGELOG.md index a0f2876..2aabbf4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Increased default inflate chunk size to 64K. - Moved exported constants to `.constants`. - Switched to es6. Legacy es5 builds available in `/dist`. +- Added esm build. - Structure of `/dist` folder changed. - Upgraded build tools to modern ones. diff --git a/package.json b/package.json index f4ebf80..8505d44 100644 --- a/package.json +++ b/package.json @@ -23,6 +23,10 @@ ], "license": "(MIT AND Zlib)", "repository": "nodeca/pako", + "exports": { + "import": "./dist/pako.esm.js", + "require": "./index.js" + }, "scripts": { "lint": "eslint .", "test": "npm run lint && mocha", diff --git a/rollup.config.js b/rollup.config.js index 9e34915..abc298f 100644 --- a/rollup.config.js +++ b/rollup.config.js @@ -75,6 +75,13 @@ export default [ { file: 'dist/pako_inflate.es5.min.js', format: 'umd', name: 'pako', plugins: [ terser() ] } ], plugins: plugins_es5 + }, + // esm + { + input: 'index.js', + output: [ + { file: 'dist/pako.esm.js', format: 'esm' } + ], + plugins: plugins } - ];