Skip to content

Commit

Permalink
Merge pull request #134 from adroitwhiz/module
Browse files Browse the repository at this point in the history
Build an ES6 module as well
  • Loading branch information
avoidwork authored Jul 9, 2021
2 parents 713000e + 405196b commit 038bfab
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
"license": "BSD-3-Clause",
"browser": "lib/filesize.min.js",
"main": "lib/filesize.js",
"module": "lib/filesize.esm.js",
"types": "filesize.d.ts",
"engines": {
"node": ">= 0.4.0"
Expand Down
8 changes: 8 additions & 0 deletions rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ const bannerShort = `/*!
*/`;

const umdOutBase = { format: 'umd', name: 'filesize' };
const esmOutBase = { format: 'esm', name: 'filesize' };

export default [
{
Expand All @@ -25,6 +26,13 @@ export default [
{ ...umdOutBase, file: 'lib/filesize.es6.min.js', banner: bannerShort, plugins: [ terser() ], sourcemap: true },
]
},
{
input: 'src/filesize.js',
output: [
{ ...esmOutBase, file: 'lib/filesize.esm.js', banner: bannerLong },
{ ...esmOutBase, file: 'lib/filesize.esm.min.js', banner: bannerShort, plugins: [ terser() ], sourcemap: true },
]
},
{
input: 'src/filesize.js',
output: [
Expand Down

0 comments on commit 038bfab

Please sign in to comment.