-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
rollup.config.js
43 lines (40 loc) · 1.08 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
const path = require('path')
const typescript = require('rollup-plugin-typescript2')
const isBuiltinModule = require('is-builtin-module')
function resolveInput(projectDir) {
return path.resolve('packages', `${projectDir}/lib/index.ts`)
}
function resolveOutput(projectDir) {
return path.resolve('packages', `${projectDir}/dist/index.js`)
}
const PKG_DIR = process.env.PKG_DIR
const pkgMeta = require(path.resolve(`packages`, `${PKG_DIR}/package.json`))
module.exports = {
input: resolveInput(PKG_DIR),
external(id) {
return (
(pkgMeta.dependencies && !!pkgMeta.dependencies[id]) ||
id === 'prismjs/components' ||
id === 'vue-template-compiler/build' ||
id === 'typedoc'
)
},
plugins: [
// resolve(),
// commonjs(),
// pluginJson(),
typescript()
],
output: {
file: resolveOutput(PKG_DIR),
format: 'cjs',
exports: 'named'
},
onwarn(warning, warn) {
console.log(warning, warn)
if (warning.code === 'UNRESOLVED_IMPORT' && isBuiltinModule(warning.source))
return
console.log('-------')
warn(warning)
}
}