-
Notifications
You must be signed in to change notification settings - Fork 5
/
rollup.config.js
46 lines (46 loc) · 1.17 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
import commonjs from 'rollup-plugin-commonjs'
import external from 'rollup-plugin-peer-deps-external'
import postcss from 'rollup-plugin-postcss'
import resolve from 'rollup-plugin-node-resolve'
import typescript from 'rollup-plugin-typescript'
import url from 'rollup-plugin-url'
import sass from 'node-sass'
import autoprefixer from 'autoprefixer'
import postcssurl from 'postcss-url'
import pkg from './package.json'
export default {
input: 'src/index.ts',
output: [
{
file: pkg.main,
format: 'cjs'
},
{
file: pkg.module,
format: 'es'
}
],
plugins: [
external(),
postcss({
preprocessor: (content, id) => new Promise(res => {
const result = sass.renderSync({ file: id })
res({ code: result.css.toString() })
}),
plugins: [autoprefixer, postcssurl({ url: 'inline' })],
minimize: true,
// extract: true,
extensions: ['.sass', '.css']
}),
typescript(),
url({
limit: 10 * 1024, // inline files < 10k, copy files > 10k
publicPath: '/',
emitFiles: true // defaults to true
}),
resolve({
extensions: ['.ts', '.tsx', '.json']
}),
commonjs()
]
}