mirror of
https://github.com/gosticks/react-table.git
synced 2025-10-16 11:55:36 +00:00
* Use preset-env instead of preset-es2015 Remove preset-stage-2 and use individual required plugins. * Expose es module build * Update scripts in package.json * Use rollup for faster and lighter umd builds Add non minified version of the build.
43 lines
870 B
JavaScript
43 lines
870 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'
|
|
|
|
const env = process.env.NODE_ENV
|
|
|
|
const config = {
|
|
input: 'src/index.js',
|
|
output: {
|
|
file: env === 'production' ? 'react-table.min.js' : 'react-table.js',
|
|
format: 'umd',
|
|
globals: {
|
|
react: 'React',
|
|
},
|
|
name: 'ReactTable',
|
|
exports: 'named',
|
|
},
|
|
external: ['react'],
|
|
plugins: [
|
|
nodeResolve(),
|
|
babel({
|
|
exclude: '**/node_modules/**',
|
|
}),
|
|
replace({
|
|
'process.env.NODE_ENV': JSON.stringify(env),
|
|
}),
|
|
commonjs(),
|
|
],
|
|
}
|
|
|
|
if (env === 'production') {
|
|
config.plugins.push(uglify({
|
|
compress: {
|
|
dead_code: true,
|
|
warnings: false,
|
|
},
|
|
}))
|
|
}
|
|
|
|
export default config
|