-
Notifications
You must be signed in to change notification settings - Fork 356
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Switch the build process to rollup.js
Makes the minified UMD build 1.2kb smaller
- Loading branch information
1 parent
8f89a1c
commit 807c3a3
Showing
3 changed files
with
240 additions
and
943 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 |
---|---|---|
@@ -0,0 +1,48 @@ | ||
import replace from 'rollup-plugin-replace'; | ||
import nodeResolve from 'rollup-plugin-node-resolve'; | ||
import commonjs from 'rollup-plugin-commonjs'; | ||
import {uglify} from 'rollup-plugin-uglify'; | ||
import babel from 'rollup-plugin-babel'; | ||
|
||
function stripEnvVariables(env) { | ||
return { | ||
__DEV__: env === 'production' ? 'false' : 'true', | ||
'process.env.NODE_ENV': `'${env}'`, | ||
}; | ||
} | ||
|
||
export default [ | ||
{ | ||
input: 'index.js', | ||
output: { | ||
file: 'prop-types.js', | ||
format: 'umd', | ||
name: 'PropTypes' | ||
}, | ||
plugins: [ | ||
babel({ | ||
exclude: 'node_modules/**' | ||
}), | ||
replace(stripEnvVariables('development')), | ||
nodeResolve(), | ||
commonjs() | ||
] | ||
}, | ||
{ | ||
input: 'index.js', | ||
output: { | ||
file: 'prop-types.min.js', | ||
format: 'umd', | ||
name: 'PropTypes' | ||
}, | ||
plugins: [ | ||
babel({ | ||
exclude: 'node_modules/**' | ||
}), | ||
replace(stripEnvVariables('production')), | ||
nodeResolve(), | ||
commonjs(), | ||
uglify() | ||
] | ||
} | ||
]; |
Oops, something went wrong.