-
-
Notifications
You must be signed in to change notification settings - Fork 185
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
69 additions
and
59 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
node_modules | ||
lib | ||
es | ||
dist/react-onclickoutside.es.js | ||
dist/react-onclickoutside.cjs.js |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,60 @@ | ||
import babel from 'rollup-plugin-babel'; | ||
import uglify from 'rollup-plugin-uglify'; | ||
import pkg from './package.json'; | ||
|
||
var config = { | ||
output: { | ||
format: process.env.BABEL_ENV, | ||
exports: 'named', | ||
}, | ||
external: ['react', 'react-dom'], | ||
plugins: [ | ||
babel({ | ||
exclude: 'node_modules/**', | ||
}), | ||
], | ||
const mergeAll = objs => Object.assign({}, ...objs); | ||
|
||
const commonPlugins = [ | ||
babel({ | ||
exclude: 'node_modules/**', | ||
}), | ||
]; | ||
|
||
const configBase = { | ||
input: 'src/index.js', | ||
external: Object.keys(pkg.dependencies || {}).concat(Object.keys(pkg.peerDependencies || {})), | ||
plugins: commonPlugins, | ||
}; | ||
|
||
export default config; | ||
const devUmdConfig = mergeAll([ | ||
configBase, | ||
{ | ||
output: { | ||
file: pkg.unpkg.replace(/\.min\.js$/, '.js'), | ||
format: 'umd', | ||
name: 'onClickOutside', | ||
exports: 'named', | ||
}, | ||
globals: { react: 'React', 'react-dom': 'ReactDOM' }, | ||
external: Object.keys(pkg.peerDependencies || {}), | ||
}, | ||
]); | ||
|
||
const prodUmdConfig = mergeAll([ | ||
devUmdConfig, | ||
{ output: mergeAll([devUmdConfig.output, { file: pkg.unpkg }]) }, | ||
{ | ||
plugins: devUmdConfig.plugins.concat( | ||
uglify({ | ||
compress: { | ||
pure_getters: true, | ||
unsafe: true, | ||
unsafe_comps: true, | ||
warnings: false, | ||
}, | ||
}) | ||
), | ||
}, | ||
]); | ||
|
||
const webConfig = mergeAll([ | ||
configBase, | ||
{ | ||
output: [ | ||
{ file: pkg.module, format: 'es' }, | ||
{ file: pkg.main, format: 'cjs', exports: 'named' } | ||
], | ||
}, | ||
]); | ||
|
||
export default [devUmdConfig, prodUmdConfig, webConfig]; |
This file was deleted.
Oops, something went wrong.