UNPKG

919 BJavaScriptView Raw
1'use strict';
2
3const babel = require('rollup-plugin-babel');
4const json = require('rollup-plugin-json');
5const commonjs = require('rollup-plugin-commonjs');
6const replace = require('rollup-plugin-replace');
7const paths = require('./paths');
8const basePresets = require('../babel.js');
9
10const config = env => ({
11 input: paths.srcPath,
12 output: {
13 file: paths.buildPath,
14 format: 'cjs',
15 banner:
16 env !== 'production'
17 ? `require('${
18 require.resolve('source-map-support').indexOf(process.cwd()) === 0
19 ? 'source-map-support/register'
20 : require.resolve('source-map-support/register')
21 }')`
22 : '',
23 },
24 sourcemap: env !== 'production',
25 plugins: [
26 json(),
27 babel({
28 babelrc: true,
29 presets: basePresets,
30 }),
31 commonjs(),
32 replace({ 'process.env.NODE_ENV': JSON.stringify(env) }),
33 ],
34});
35
36module.exports = config;