react-context-component
Version:
This is a React component that lets you add things in the context. Put simply, the [context feature](https://facebook.github.io/react/docs/context.html) basically lets you to pass some data through all nodes in the components tree.
48 lines (43 loc) • 988 B
JavaScript
import nodeResolve from 'rollup-plugin-node-resolve'
import babel from 'rollup-plugin-babel'
import replace from 'rollup-plugin-replace'
import commonjs from 'rollup-plugin-commonjs'
import uglify from 'rollup-plugin-uglify'
import { minify } from 'uglify-es'
const env = process.env.NODE_ENV
const config = {
entry: 'src/index.jsx',
external: ['react', 'prop-types'],
globals: {
react: 'React'
},
format: 'umd',
moduleName: 'ReactWidth',
plugins: [
nodeResolve({ extensions: ['.js', '.jsx'] }),
babel({
exclude: '**/node_modules/**',
plugins: ['babel-plugin-external-helpers']
}),
replace({
'process.env.NODE_ENV': JSON.stringify(env)
}),
commonjs()
]
}
if (env === 'production') {
config.plugins.push(
uglify(
{
compress: {
pure_getters: true,
unsafe: true,
unsafe_comps: true,
warnings: false
}
},
minify
)
)
}
export default config