1 | import string from 'rollup-plugin-string'
|
2 | import json from 'rollup-plugin-json'
|
3 | import commonjs from 'rollup-plugin-commonjs'
|
4 | import uglify from 'rollup-plugin-uglify'
|
5 | import { minify } from 'uglify-es'
|
6 | import { dependencies } from '../package.json'
|
7 |
|
8 | const external = [...Object.keys(dependencies), 'fs', 'path']
|
9 | export default {
|
10 | input: 'src/bin/index.js',
|
11 | output: {
|
12 | file: 'dist/weact-cli',
|
13 | format: 'cjs',
|
14 | banner: '#!/usr/bin/env node',
|
15 | },
|
16 | plugins: [
|
17 | json(),
|
18 | string({ include: '**/*.md' }),
|
19 | commonjs({
|
20 | sourceMap: false,
|
21 | namedExports: {
|
22 | 'src/bin/transform.js': ['transform'],
|
23 | },
|
24 | ignore: [
|
25 | '@babel/traverse',
|
26 | '@babel/generator',
|
27 | ]
|
28 | }),
|
29 | process.env.BUILD === 'production' ? uglify({}, minify) : false,
|
30 | ],
|
31 | external,
|
32 | }
|