1 |
|
2 | import resolve from 'rollup-plugin-node-resolve';
|
3 | import commonjs from 'rollup-plugin-commonjs';
|
4 | import babel from 'rollup-plugin-babel';
|
5 | import alias from 'rollup-plugin-alias';
|
6 | import replace from 'rollup-plugin-replace';
|
7 | import path from 'path';
|
8 | import fs from 'fs';
|
9 |
|
10 | const dependencies = Object.keys(require('./package.json').dependencies)
|
11 | const appDirectory = fs.realpathSync(process.cwd());
|
12 | const resolveApp = relativePath => path.resolve(appDirectory, relativePath);
|
13 |
|
14 | export default [
|
15 | {
|
16 | input: 'src/index.js',
|
17 | output: {
|
18 | file: 'dist/bundle.main.js',
|
19 | format: 'umd',
|
20 | name: 'Mirage',
|
21 | globals: {
|
22 | react: 'React',
|
23 | 'prop-types': 'PropTypes',
|
24 | 'styled-components': 'styled'
|
25 | }
|
26 | },
|
27 |
|
28 | external: dependencies,
|
29 | plugins: [
|
30 |
|
31 | resolve(),
|
32 | babel({
|
33 | exclude: 'node_modules/**'
|
34 | }),
|
35 | alias({
|
36 | SRC: resolveApp('src'),
|
37 | resolve: ['.js', '/index.js'] ,
|
38 | }),
|
39 | commonjs({
|
40 | include: 'node_modules/**',
|
41 | exclude: ['node_modules/react', 'node_modules/react-dom'],
|
42 | namedExports: {
|
43 |
|
44 |
|
45 |
|
46 | 'react-sizeme': [ 'withSize' ]
|
47 | }
|
48 | })
|
49 | ]
|
50 | },
|
51 | {
|
52 | input: 'src/index.js',
|
53 | output: {
|
54 | file: 'dist/bundle.module.js',
|
55 | format: 'cjs'
|
56 | },
|
57 |
|
58 | external: dependencies,
|
59 | plugins: [
|
60 | resolve(),
|
61 | babel({
|
62 | exclude: 'node_modules/**'
|
63 | }),
|
64 | alias({
|
65 | SRC: resolveApp('src'),
|
66 | resolve: ['.js', '/index.js'] ,
|
67 | }),
|
68 | ]
|
69 | }
|
70 | ]
|