Skip to content

Commit

Permalink
Add UMD build
Browse files Browse the repository at this point in the history
  • Loading branch information
perliedman authored and gilbarbara committed Dec 8, 2019
1 parent 216b12d commit 35c5810
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
4 changes: 3 additions & 1 deletion package.json
Expand Up @@ -114,7 +114,9 @@
"yargs": "^15.0.2"
},
"scripts": {
"build": "cross-env NODE_ENV=production npm run clean && rollup -c",
"build": "npm run clean && npm run build:base && npm run build:umd",
"build:base": "cross-env NODE_ENV=production rollup -c",
"build:umd": "cross-env NODE_ENV=production rollup -c rollup.config.umd.js",
"watch": "rollup -cw",
"clean": "rimraf es && rimraf lib",
"lint": "eslint --ext .js --ext .jsx src test",
Expand Down
22 changes: 22 additions & 0 deletions rollup.config.umd.js
@@ -0,0 +1,22 @@
import resolve from 'rollup-plugin-node-resolve';
import packageJSON from './package.json';
import baseConfig from './rollup.config';

export default {
input: 'src/index.js',
output: [
{
file: 'lib/index.umd.js',
format: 'umd',
name: 'Floater',
intro: 'var global = typeof self !== undefined ? self : this;',
globals: {
react: 'React',
'prop-types': 'PropTypes',
'react-dom': 'ReactDOM',
},
},
],
external: [...Object.keys(packageJSON.peerDependencies)],
plugins: [...baseConfig.plugins, resolve()],
};

0 comments on commit 35c5810

Please sign in to comment.