-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathrollup.config.docs.js
88 lines (84 loc) · 2.05 KB
/
rollup.config.docs.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
import babel from 'rollup-plugin-babel';
import commonjs from 'rollup-plugin-commonjs';
import eslint from 'rollup-plugin-eslint';
import path from 'path';
import postcss from 'rollup-plugin-postcss';
import replace from 'rollup-plugin-replace';
import resolve from 'rollup-plugin-node-resolve';
// postcss plugins
import simplevars from 'postcss-simple-vars';
import cssnext from 'postcss-cssnext';
import cssnano from 'cssnano';
import postcssImport from 'postcss-import';
import postcssModules from 'postcss-modules';
var cache;
const cssExportMap = {};
export default {
input: 'src/app.js',
cache: cache,
output: {
name: 'arrayMatrix',
file: 'dev/script/index.umd.js',
format: 'umd',
sourcemap: true,
sourcemapFile: path.resolve('dev/main.umd.js'),
},
plugins: [
postcss({
sourceMap: 'inline', // true, "inline" or false
extract : 'dev/style.css',
extensions: ['.css'],
plugins: [
postcssImport(),
simplevars(),
cssnext({
warnForDuplicates: false,
}),
postcssModules({
getJSON (id, exportTokens) {
cssExportMap[id] = exportTokens;
}
}),
cssnano(),
],
getExport (id) {
return cssExportMap[id];
},
}),
resolve({
module: true,
jsnext: true,
main: true,
browser: true,
extensions: ['.js', '.jsx'],
customResolveOptions: {
moduleDirectory: 'node_modules'
}
}),
replace({ 'process.env.NODE_ENV': JSON.stringify('development') }),
commonjs({
include: [
'node_modules/**'
],
exclude: [
'node_modules/process-es6/**'
],
namedExports: {
'node_modules/react/index.js': ['Children', 'Component', 'PropTypes', 'createElement'],
'node_modules/react-dom/index.js': ['render']
}
}),
eslint({
exclude: [
'**/*.css',
'node_modules/**'
]
}),
babel({
exclude: [
'node_modules/**',
'__tests__/**',
],
}),
],
}