forked from dvanoni/notero
-
Notifications
You must be signed in to change notification settings - Fork 0
/
esbuild.js
48 lines (43 loc) · 1.16 KB
/
esbuild.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
const esbuild = require('esbuild');
require('@dvanoni/zotero-plugin/copy-assets');
require('@dvanoni/zotero-plugin/generate-install-manifest');
require('@dvanoni/zotero-plugin/version');
const banner = `if (!Zotero.Notero) {
// Make timer functions globally available in Zotero 6
if (typeof setTimeout === 'undefined') {
var setTimeout = Zotero.setTimeout;
}
if (typeof clearTimeout === 'undefined') {
var clearTimeout = Zotero.clearTimeout;
}
`;
const builds = [
{
entryPoints: ['src/bootstrap.ts'],
keepNames: true,
outdir: 'build',
target: ['firefox60'],
},
{
bundle: true,
format: 'iife',
target: ['firefox60'],
entryPoints: ['src/content/notero.ts'],
outdir: 'build/content',
banner: { js: banner },
footer: { js: '\n}' },
},
{
bundle: true,
format: 'iife',
globalName: 'notero',
target: ['firefox60'],
entryPoints: ['src/content/prefs/preferences.tsx'],
external: ['components/*', 'react', 'react-dom', 'react-intl'],
outdir: 'build/content/prefs',
},
].map((buildOptions) => esbuild.build(buildOptions));
Promise.all(builds).catch((err) => {
console.error(err);
process.exit(1);
});