-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathrollup.config.mjs
41 lines (39 loc) · 1.07 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
// @ts-check
import { defineConfig } from 'rollup';
import typescript from '@rollup/plugin-typescript';
import { readFileSync } from 'fs';
import mwGadget from 'rollup-plugin-mediawiki-gadget';
import replace from '@rollup/plugin-replace';
const compat = process.env.COMPAT !== undefined;
export default defineConfig({
input: 'lib/index.ts',
output: {
file: 'dist/Gadget-HanAssist.js',
format: 'umd', // Use UMD so the script works outside a module system
name: 'mw.libs.HanAssist',
amd: {
id: 'HanAssist',
},
inlineDynamicImports: true,
banner: readFileSync('./assets/intro.js').toString(),
footer: readFileSync('./assets/outro.js').toString(),
},
plugins: [
typescript({
outputToFilesystem: true,
compilerOptions: {
// MediaWiki >= 1.42.0-wmf.13 supports ES2016
target: 'ES2016',
},
declaration: true,
include: ['lib/**/*.ts'],
}),
replace({
preventAssignment: true,
COMPAT: JSON.stringify(compat),
}),
mwGadget({
gadgetDef: '.gadgetdefinition',
}),
],
});