forked from vuese/vuese
-
Notifications
You must be signed in to change notification settings - Fork 0
/
rollup.config.js
40 lines (36 loc) · 1 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
import path from 'path'
import typescript from 'rollup-plugin-typescript2'
import isBuiltinModule from '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`))
export default {
input: resolveInput(PKG_DIR),
external(id) {
return (
(pkgMeta.dependencies && !!pkgMeta.dependencies[id]) ||
id === 'prismjs/components' ||
id === 'vue-template-compiler/build'
)
},
plugins: [
typescript({
cacheRoot: path.resolve(__dirname, 'node_modules/.rts2_cache')
})
],
output: {
file: resolveOutput(PKG_DIR),
format: 'cjs',
exports: 'named'
},
onwarn(warning, warn) {
if (warning.code === 'UNRESOLVED_IMPORT' && isBuiltinModule(warning.source))
return
warn(warning)
}
}