-
Notifications
You must be signed in to change notification settings - Fork 0
/
rollup.appx.config.js
59 lines (55 loc) · 1.09 KB
/
rollup.appx.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
/**
* 小程序产物编译配置
*/
import inject from '@rollup/plugin-inject';
const module = '@galacean/engine-miniprogram-adapter';
const commonAdapterList = [
'window',
'navigator',
'HTMLElement',
'HTMLImageElement',
'HTMLCanvasElement',
'HTMLVideoElement',
'document',
'WebGLRenderingContext',
'Image',
'URL',
'location',
'XMLHttpRequest',
'Blob',
'performance',
'requestAnimationFrame',
'cancelAnimationFrame',
];
const adapterList = {
alipay: [...commonAdapterList],
}
const globals = {
'@galacean/engine': 'Galacean',
};
export default [
'alipay',
].map(platform => {
const adapterVars = {};
adapterList[platform].forEach(name => {
adapterVars[name] = [`${module}`, name];
});
return {
input: `src/index.ts`,
external: ['@galacean/engine'],
output: [{
globals,
file: `./dist/${platform}-miniprogram.mjs`,
format: 'es',
sourcemap: true,
}, {
globals,
file: `./dist/${platform}-miniprogram.js`,
format: 'cjs',
sourcemap: true,
}],
plugins: [
inject(adapterVars),
],
};
});