-
Notifications
You must be signed in to change notification settings - Fork 3
/
tsdx.config.js
41 lines (39 loc) · 1.02 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
40
41
const postcss = require('rollup-plugin-postcss')
const peerDepsExternal = require('rollup-plugin-peer-deps-external')
const pkg = require('./package.json')
const { nodeResolve } = require('@rollup/plugin-node-resolve')
const extensions = ['.js', '.jsx', '.ts', '.tsx']
const externals = [
...Object.keys(pkg.dependencies || {}),
...Object.keys(pkg.peerDependencies || {}),
'./src'
]
module.exports = {
rollup(config, options) {
if (config.output.format === 'umd') {
delete config.external
}
config.external = externals
config.plugins.push(
peerDepsExternal(),
nodeResolve({
ignoreGlobal: false,
include: ['node_modules/**'],
extensions
// skip: keys(externals) // <<-- skip: ['react', 'react-dom']
}),
postcss({
config: {
path: './postcss.config.js'
},
extensions: ['.css'],
minimize: true,
inject: {
insertAt: 'top'
},
sourceMap: false
})
)
return config
}
}