forked from jsonmvc/jsonmvc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrollup.config.js
87 lines (83 loc) · 2.3 KB
/
rollup.config.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
const resolve = require('rollup-plugin-node-resolve')
const alias = require('rollup-plugin-alias')
const commonjs = require('rollup-plugin-commonjs')
const builtins = require('rollup-plugin-node-builtins')
const nodeResolve = require('rollup-plugin-node-resolve')
const replace = require('rollup-plugin-replace')
const babel = require('rollup-plugin-babel')
const globals = require('rollup-plugin-node-globals')
const rollupGrapher = require('rollup-plugin-grapher')
const json = require('rollup-plugin-json')
const uglify = require('rollup-plugin-uglify')
console.log(`
vue.esm.js:10043 must be patched with:
if (document.activeElement === 'elm') {
elm.value = strCur;
}
`)
module.exports = config => {
let root = __dirname + '/packages/' + config.package
return {
input: root + '/src/index.js',
plugins: [
// uglify(),
// rollupGrapher({
// dest: __dirname + '/../dist/build-graph.html'
// }),
nodeResolve({
jsnext: true,
main: true,
browser: true
}),
json(),
alias({
'_vue': root + '/node_modules/vue/dist/vue.esm.js',
'symbol-observable': root + '/node_modules/symbol-observable/es/index.js'
}),
babel({
babelrc: false,
exclude: root + '/node_modules/**',
presets: [
[
'es2015',
{
modules: false
}
]
],
plugins: [
'lodash',
'external-helpers'
]
}),
commonjs({
include: root + '/node_modules/**',
namedExports: {
'zen-observable': ['default']
}
}),
replace({
'process.env.NODE_ENV': JSON.stringify('production'),
'process.env.NODE_UNIQUE_ID': JSON.stringify('0')
}),
builtins(),
globals(),
resolve()
],
external: ['firebase', 'jsonmvc-helper-observer', 'jsonmvc-helper-guid'],
file: root + '/dist/' + config.package + '.js',
format: 'umd',
name: config.package,
globals: {
firebase: 'firebase',
'jsonmvc-helper-guid': 'jsonmvc-helper-guid'
},
// external: ['lodash', 'lodash-es', 'setimmediate'],
output: {
file: root + '/dist/' + config.package + '.js',
format: 'umd',
name: config.package,
sourcemap: true,
}
}
}