-
Notifications
You must be signed in to change notification settings - Fork 6
/
tsdx.config.js
39 lines (37 loc) · 1.29 KB
/
tsdx.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
const postcss = require('rollup-plugin-postcss')
const autoprefixer = require('autoprefixer')
const tailwindcss = require('tailwindcss')
const cssnano = require('cssnano')
const replace = require('@rollup/plugin-replace')
const analyze = require('rollup-plugin-analyzer')
module.exports = {
rollup(config, options) {
config.plugins.push(
postcss({
plugins: [
tailwindcss({
content: ['./src/**/*.{tsx,ts,css}'],
darkMode: 'class', // or 'media' or 'class'
theme: { extend: {} },
plugins: [],
}),
autoprefixer(),
cssnano({ preset: 'default' }),
],
minimize: true,
inject: { insertAt: 'top' },
// only write out CSS for the first bundle (avoids pointless extra files):
extract: !!options.writeMeta,
}),
)
config.plugins.push(analyze({ summaryOnly: true }))
config.plugins = config.plugins.map(p =>
p.name === 'replace'
? replace({
preventAssignment: true,
})
: p,
)
return config
},
}