forked from yongjun21/st-scrolly
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrollup.config.js
65 lines (60 loc) · 1.44 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
import path from 'path'
import buble from 'rollup-plugin-buble'
import vue from 'rollup-plugin-vue'
import css from 'rollup-plugin-css-only'
import sass from 'rollup-plugin-sass'
import commonjs from 'rollup-plugin-commonjs'
const PKG_DIR = 'packages/@st-graphics'
const packages = [
'scrolly',
'video-scrolly',
'object-fit-video'
]
export default [
...packages.map(createVueBuild),
...packages.map(createReactBuild)
]
function createVueBuild (pkg) {
return {
input: path.join(PKG_DIR, pkg, 'src/index.vue'),
output: [{
format: 'esm',
file: path.join(PKG_DIR, pkg, 'dist/index.js'),
sourcemap: true
}, {
format: 'cjs',
file: path.join(PKG_DIR, pkg, 'dist/legacy.js'),
sourcemap: true
}],
plugins: [
css({ output: path.join(PKG_DIR, pkg, 'dist/bundle.css') }),
vue({ css: false }),
buble(),
commonjs()
]
}
}
function createReactBuild (pkg) {
pkg = 'react-' + pkg
return {
external: [
'react',
'prop-types',
'classnames'
],
input: path.join(PKG_DIR, pkg, 'src/index.jsx'),
output: [{
format: 'esm',
file: path.join(PKG_DIR, pkg, 'dist/index.js'),
sourcemap: true
}, {
format: 'cjs',
file: path.join(PKG_DIR, pkg, 'dist/legacy.js'),
sourcemap: true
}],
plugins: [
sass({ output: path.join(PKG_DIR, pkg, 'dist/bundle.css') }),
buble({ objectAssign: 'Object.assign' })
]
}
}