forked from gamedevsam/phaser
-
Notifications
You must be signed in to change notification settings - Fork 0
/
rollup.config.js
78 lines (69 loc) · 1.96 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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
import filesize from 'rollup-plugin-filesize';
import resolve from '@rollup/plugin-node-resolve';
import { terser } from 'rollup-plugin-terser';
import typescript from 'rollup-plugin-typescript2';
// Can't use official TypeScript plugin because: https://github.com/rollup/plugins/issues/287 >:-(
const extensions = [
'.js', '.jsx', '.ts', '.tsx'
];
const licenseInfo =
`/**
* @author Richard Davey <[email protected]>
* @copyright 2021 Photon Storm Ltd.
* @license {@link https://opensource.org/licenses/MIT|MIT License}
*/`;
export default [
{
// UMD Bundle
input: './src/index.ts',
onwarn: (warning, next) =>
{
// Because the TypeScript plugin will create d.ts files
// that already exist, so let's not spam the console
// with them.
if (warning.code === 'FILE_NAME_CONFLICT')
{
return;
}
else
{
next(warning);
}
},
output: [
{
file: './dist/umd/Phaser.js',
format: 'umd',
name: 'Phaser',
sourcemap: true,
esModule: false,
plugins: [
filesize()
]
},
{
file: './dist/umd/Phaser.min.js',
format: 'umd',
name: 'Phaser',
sourcemap: false,
esModule: false,
plugins: [
terser({
output: {
preamble: licenseInfo,
comments: false
}
})
]
}
],
plugins: [
resolve({
extensions
}),
typescript({
tsconfig: './tsconfig-umd.json'
})
]
}
];