-
Notifications
You must be signed in to change notification settings - Fork 47
/
rollup.config.js
executable file
·56 lines (53 loc) · 1.61 KB
/
rollup.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
import summary from 'rollup-plugin-summary';
import { terser } from 'rollup-plugin-terser';
import resolve from '@rollup/plugin-node-resolve';
import replace from '@rollup/plugin-replace';
import copy from 'rollup-plugin-copy';
export default {
input: 'src/ms-store-badge.js',
output: {
file: 'dist/ms-store-badge.bundled.js',
format: 'esm',
},
onwarn(warning) {
if (warning.code !== 'THIS_IS_UNDEFINED') {
console.error(`(!) ${warning.message}`);
}
},
plugins: [
replace({
'Reflect.decorate': 'undefined',
// Mark us as production
'window.__rollup_injected_env': '"prod"',
delimiters: ['', ''],
preventAssignment: true
}),
copy({
targets: [
{ src: 'src/images', dest: 'dist' },
{ src: 'src/staticwebapp.config.json', dest: 'dist' },
{ src: 'src/iframe.html', dest: 'dist' },
{ src: 'src/9p1j8s7ccwwt_us_en-us.html', dest: 'dist' },
{ src: 'src/index.html', dest: 'dist' },
{ src: 'dist/ms-store-badge.bundled.js', dest: 'dist/badge' }, // Copy to a badge subdirectory so that we can serve the badge script from get.microsoft.com/badge/ms-store-badge.bundled.js
{
src: 'src/index.html',
dest: 'dist',
transform: (contents) => contents.toString().replace(new RegExp('/ms-store-badge.js', 'g'), 'https://getbadgecdn.azureedge.net/ms-store-badge.bundled.js')
}
]
}),
resolve(),
terser({
ecma: 2020,
module: true,
warnings: true,
mangle: {
properties: {
regex: /^__/,
},
},
}),
summary()
],
};