forked from glukki/telegram-replies-only-bot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
rollup.config.ts
48 lines (46 loc) · 1.27 KB
/
rollup.config.ts
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
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
import * as fs from 'fs'
import { defineConfig } from 'rollup'
import { terser } from 'rollup-plugin-terser'
import { nodeResolve } from '@rollup/plugin-node-resolve'
import commonjs from '@rollup/plugin-commonjs'
import typescript from '@rollup/plugin-typescript'
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
import importHttp from 'import-http/rollup'
import replace from '@rollup/plugin-replace'
const packageJson = JSON.parse(fs.readFileSync('./package.json', 'utf8'))
const grammyVersion = packageJson.dependencies.grammy
export default defineConfig({
input: 'src/index.ts',
output: {
exports: 'named',
format: 'es',
file: 'dist/index.mjs',
sourcemap: true,
},
plugins: [
replace({
include: 'src/**',
preventAssignment: true,
values: {
grammy: `https://get.grammy.dev/es6@v${grammyVersion}.js`,
},
}),
replace({
exclude: 'src/**',
preventAssignment: true,
values: {
'typeof Deno': '"undefined"',
'Deno === null': 'true',
'typeof window': '"undefined"',
},
}),
importHttp(),
typescript(),
commonjs(),
nodeResolve({ browser: true }),
terser(),
],
})