-
Notifications
You must be signed in to change notification settings - Fork 0
/
rollup.config.mjs
61 lines (52 loc) · 1.35 KB
/
rollup.config.mjs
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
61
import pkg from './package.json' assert { type: 'json' }
import json from '@rollup/plugin-json'
import resolve from '@rollup/plugin-node-resolve'
import esbuild from 'rollup-plugin-esbuild'
import commonjs from '@rollup/plugin-commonjs'
import { typescriptPaths } from 'rollup-plugin-typescript-paths'
import nodePolyfills from 'rollup-plugin-polyfill-node'
//import dts from 'rollup-plugin-dts'
const generatedCode = {
arrowFunctions: true,
constBindings: true,
objectShorthand: true
}
const esm = {
generatedCode,
file: pkg.exports.import,
format: 'es'
}
const cjs = {
generatedCode,
file: pkg.exports.require,
format: 'cjs'
// name: 'earthmc',
// globals: {
// 'mojang-lib': 'mojanglib',
// 'timed-cache': 'timedcache'
// }
}
const source = {
input: 'src/main.ts',
external: [...Object.keys(pkg.dependencies)],
output: [esm, cjs],
plugins: [
typescriptPaths({ preserveExtensions: true }),
json(),
nodePolyfills(),
resolve({ preferBuiltins: true }),
commonjs({
requireReturnsDefault: 'auto'
}),
esbuild({ exclude: ["**/*.test.ts"] })
]
}
// const types = {
// input: 'src/types/index.ts',
// output: [{
// file: pkg.types,
// format: 'es'
// }],
// plugins: [dts()]
// }
export default [source]