Skip to content

Commit

Permalink
feat: add UMD build (#92)
Browse files Browse the repository at this point in the history
  • Loading branch information
bryangingechen authored and targos committed Aug 16, 2019
1 parent 4b70258 commit 3b82b07
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 8 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
.idea
node_modules
/matrix.js
/matrix.umd.js
coverage/
6 changes: 6 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,14 @@
"description": "Matrix manipulation and computation library",
"main": "matrix.js",
"module": "src/index.js",
"jsdelivr": "matrix.umd.js",
"unpkg": "matrix.umd.js",
"types": "matrix.d.ts",
"sideEffects": false,
"files": [
"matrix.d.ts",
"matrix.js",
"matrix.umd.js",
"src"
],
"scripts": {
Expand Down Expand Up @@ -66,6 +69,9 @@
"numeric": "^1.2.6",
"pretty-hrtime": "^1.0.3",
"rollup": "^1.16.3",
"rollup-plugin-commonjs": "^10.0.2",
"rollup-plugin-node-resolve": "^5.2.0",
"rollup-plugin-terser": "^5.1.1",
"typedoc": "^0.14.2"
},
"dependencies": {
Expand Down
36 changes: 28 additions & 8 deletions rollup.config.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,29 @@
export default {
input: 'src/index.js',
output: {
file: 'matrix.js',
format: 'cjs',
exports: 'named'
import resolve from 'rollup-plugin-node-resolve';
import commonJS from 'rollup-plugin-commonjs';
import { terser } from 'rollup-plugin-terser';

export default [
{
input: 'src/index.js',
output: {
file: 'matrix.js',
format: 'cjs',
exports: 'named'
},
external: ['ml-array-rescale']
},
external: ['ml-array-rescale']
};
{
input: 'src/index.js',
output: {
name: 'mlMatrix',
file: 'matrix.umd.js',
format: 'umd',
exports: 'named'
},
plugins: [
resolve(),
commonJS(),
terser()
]
}
];

0 comments on commit 3b82b07

Please sign in to comment.