-
Notifications
You must be signed in to change notification settings - Fork 2
/
rollup.config.js
58 lines (53 loc) · 1.24 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
47
48
49
50
51
52
53
54
55
56
57
58
import * as path from 'path'
import { nodeResolve } from '@rollup/plugin-node-resolve';
import commonjs from '@rollup/plugin-commonjs';
import { externals } from 'rollup-plugin-node-externals'
import ts from 'rollup-plugin-ts'
const base = {
plugins: [
commonjs(),
nodeResolve(),
externals({
include: [
'@tarojs/runtime',
'@tarojs/service',
'@tarojs/shared',
'@tarojs/webpack5-runner'
]
}),
ts()
]
}
// 供 CLI 编译时使用的 Taro 插件入口
const compileConfig = {
input: path.join(__dirname, 'src/index.ts'),
output: {
file: path.join(__dirname, 'lib/index.js'),
format: 'cjs',
sourcemap: true,
exports: 'named'
},
...base
}
// Svelte Loader
const loaderConfig = {
input: path.join(__dirname, 'src/taroSvelteLoader.ts'),
output: {
file: path.join(__dirname, 'lib/taroSvelteLoader.js'),
format: 'cjs',
sourcemap: true,
exports: 'named'
},
...base
}
// 供 Loader 使用的运行时入口
const runtimeConfig = {
input: path.join(__dirname, 'src/runtime/index.ts'),
output: {
file: path.join(__dirname, 'lib/runtime.js'),
format: 'es',
sourcemap: true
},
...base
}
export default [compileConfig, runtimeConfig, loaderConfig]