2019-04-03 19:12:51 +02:00
|
|
|
import babel from 'rollup-plugin-babel';
|
|
|
|
import flow from 'rollup-plugin-flow';
|
|
|
|
import includePaths from 'rollup-plugin-includepaths';
|
2019-04-23 19:22:14 +02:00
|
|
|
import copy from 'rollup-plugin-copy';
|
2019-08-22 17:03:13 +02:00
|
|
|
import replace from 'rollup-plugin-replace';
|
2019-04-03 19:12:51 +02:00
|
|
|
|
|
|
|
let includePathOptions = {
|
2019-04-23 19:22:14 +02:00
|
|
|
include: {},
|
|
|
|
paths: ['src'],
|
|
|
|
external: [],
|
|
|
|
extensions: ['.js'],
|
2019-04-03 19:12:51 +02:00
|
|
|
};
|
|
|
|
|
2019-08-22 17:03:13 +02:00
|
|
|
const production = process.env.NODE_ENV === 'production';
|
|
|
|
|
2019-04-03 19:12:51 +02:00
|
|
|
export default {
|
|
|
|
input: 'src/index.js',
|
|
|
|
output: {
|
|
|
|
file: 'dist/bundle.es.js',
|
2019-04-23 19:22:14 +02:00
|
|
|
format: 'cjs',
|
2019-04-03 19:12:51 +02:00
|
|
|
},
|
|
|
|
plugins: [
|
2019-04-23 19:22:14 +02:00
|
|
|
flow({ all: true }),
|
2019-04-03 19:12:51 +02:00
|
|
|
includePaths(includePathOptions),
|
|
|
|
babel({
|
|
|
|
babelrc: false,
|
2019-04-23 19:22:14 +02:00
|
|
|
presets: ['stage-2'],
|
2019-04-03 19:12:51 +02:00
|
|
|
}),
|
2019-04-23 19:22:14 +02:00
|
|
|
copy({ targets: ['flow-typed'] }),
|
2019-08-22 17:03:13 +02:00
|
|
|
replace({
|
|
|
|
'process.env.NODE_ENV': production
|
|
|
|
? JSON.stringify('production')
|
|
|
|
: JSON.stringify('development'),
|
|
|
|
}),
|
2019-04-03 19:12:51 +02:00
|
|
|
],
|
2019-04-23 19:22:14 +02:00
|
|
|
};
|