Skip to content

Commit 797c58a

Browse files
author
Guillaume Chau
committed
Improved rollup config
1 parent 3633e3f commit 797c58a

File tree

5 files changed

+40
-60
lines changed

5 files changed

+40
-60
lines changed

.babelrc

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,5 @@
77
}
88
],
99
"stage-0"
10-
],
11-
"plugins": [
12-
"external-helpers"
1310
]
1411
}

rollup.config.base.js

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import commonjs from 'rollup-plugin-commonjs'
2+
import resolve from 'rollup-plugin-node-resolve'
3+
import babel from 'rollup-plugin-babel'
4+
5+
export default {
6+
entry: 'src/index.js',
7+
exports: 'named',
8+
moduleName: 'vue-apollo',
9+
plugins: [
10+
resolve({
11+
jsnext: true,
12+
main: true,
13+
browser: true,
14+
}),
15+
commonjs(),
16+
babel({
17+
exclude: 'node_modules/**',
18+
plugins: [
19+
'external-helpers',
20+
],
21+
}),
22+
],
23+
}

rollup.config.browser.js

Lines changed: 7 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,13 @@
1-
import commonjs from 'rollup-plugin-commonjs'
2-
import resolve from 'rollup-plugin-node-resolve'
3-
import babel from 'rollup-plugin-babel'
1+
import base from './rollup.config.base'
42
import uglify from 'rollup-plugin-uglify'
53
import { minify } from 'uglify-js-harmony'
64

7-
export default {
8-
entry: 'src/index.js',
5+
const config = Object.assign({}, base, {
96
dest: 'dist/vue-apollo.min.js',
107
format: 'iife',
11-
exports: 'named',
128
moduleName: 'VueApollo',
13-
plugins: [
14-
resolve({
15-
jsnext: true,
16-
main: true,
17-
browser: true,
18-
}),
19-
commonjs(),
20-
babel({
21-
exclude: 'node_modules/**',
22-
}),
23-
uglify({}, minify),
24-
],
25-
}
9+
})
10+
11+
config.plugins.push(uglify({}, minify))
12+
13+
export default config

rollup.config.es.js

Lines changed: 5 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,8 @@
1-
import commonjs from 'rollup-plugin-commonjs'
2-
import resolve from 'rollup-plugin-node-resolve'
3-
import babel from 'rollup-plugin-babel'
1+
import base from './rollup.config.base'
42

5-
export default {
6-
entry: 'src/index.js',
3+
const config = Object.assign({}, base, {
74
dest: 'dist/vue-apollo.esm.js',
85
format: 'es',
9-
exports: 'named',
10-
moduleName: 'vue-apollo',
11-
plugins: [
12-
resolve({
13-
jsnext: true,
14-
main: true,
15-
browser: true,
16-
}),
17-
commonjs(),
18-
babel({
19-
exclude: 'node_modules/**',
20-
}),
21-
],
22-
}
6+
})
7+
8+
export default config

rollup.config.umd.js

Lines changed: 5 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,8 @@
1-
import commonjs from 'rollup-plugin-commonjs'
2-
import resolve from 'rollup-plugin-node-resolve'
3-
import babel from 'rollup-plugin-babel'
1+
import base from './rollup.config.base'
42

5-
export default {
6-
entry: 'src/index.js',
3+
const config = Object.assign({}, base, {
74
dest: 'dist/vue-apollo.umd.js',
85
format: 'umd',
9-
exports: 'named',
10-
moduleName: 'vue-apollo',
11-
plugins: [
12-
resolve({
13-
jsnext: true,
14-
main: true,
15-
browser: true,
16-
}),
17-
commonjs(),
18-
babel({
19-
exclude: 'node_modules/**',
20-
}),
21-
],
22-
}
6+
})
7+
8+
export default config

0 commit comments

Comments
 (0)