forked from zgqwork/wxapkg-unpacker
-
Notifications
You must be signed in to change notification settings - Fork 104
/
rollup.config.js
60 lines (59 loc) · 1.48 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
59
60
import json from '@rollup/plugin-json'
import commonjs from '@rollup/plugin-commonjs'
import nodeResolve from '@rollup/plugin-node-resolve'
import typescript from 'rollup-plugin-typescript2'
import packages from './package.json'
import { terser } from 'rollup-plugin-terser'
import license from 'rollup-plugin-license'
import { join } from 'path'
import clear from 'rollup-plugin-clear'
export const output = {
dir: 'dist',
format: 'cjs',
manualChunks(id) {
if (id.includes('wxml-parser-js')) return 'parser'
if (id.includes('traverse.ts')) return 'traverse'
},
}
const external = Object.keys(packages['dependencies'])
export default {
input: 'src/index.ts',
output,
external,
plugins: [
clear({
targets: [output.dir],
}),
typescript({
tsconfigOverride: {
compilerOptions: {
module: 'ES2015',
declaration: false,
},
},
}),
commonjs(),
nodeResolve({ preferBuiltins: true }),
json(),
terser(),
license({
banner: {
commentStyle: 'ignored',
content:
'<%= pkg.name %> v<%= pkg.version %>\n' +
'(c) 2023 <%= pkg.author %>\n' +
'Released under the <%= pkg.license %> License.',
},
thirdParty: {
output: join(__dirname, 'dist', 'dependencies.txt'),
},
}),
],
cache: false,
strictDeprecations: true,
treeshake: {
moduleSideEffects: false,
propertyReadSideEffects: false,
tryCatchDeoptimization: false,
},
}