1 | 'use strict';
|
2 |
|
3 | const babel = require('rollup-plugin-babel');
|
4 | const json = require('rollup-plugin-json');
|
5 | const commonjs = require('rollup-plugin-commonjs');
|
6 | const replace = require('rollup-plugin-replace');
|
7 | const paths = require('./paths');
|
8 | const basePresets = require('../babel.js');
|
9 |
|
10 | const 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 |
|
36 | module.exports = config;
|