forked from sweetalert2/sweetalert2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
rollup.config.js
48 lines (43 loc) · 1.08 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
import { readFileSync } from 'fs'
import babel from '@rollup/plugin-babel'
import terser from '@rollup/plugin-terser'
const packageJson = JSON.parse(readFileSync('package.json'))
const version = process.env.VERSION || packageJson.version
const banner = `/*!
* ${packageJson.name} v${version}
* Released under the ${packageJson.license} License.
*/`
const footer = `\
if (typeof this !== 'undefined' && this.Sweetalert2){\
this.swal = this.sweetAlert = this.Swal = this.SweetAlert = this.Sweetalert2\
}`
const output = {
format: 'umd',
name: 'Sweetalert2',
file: 'dist/sweetalert2.js',
banner,
footer,
}
export default {
plugins: [
babel({
babelHelpers: 'bundled',
presets: ['@babel/preset-env'],
}),
],
input: 'src/sweetalert2.js',
output: [
output,
{
...output,
file: 'dist/sweetalert2.min.js',
plugins: [terser()],
},
],
// https://github.com/rollup/rollup/issues/2271
onwarn(warning, rollupWarn) {
if (warning.code !== 'CIRCULAR_DEPENDENCY' && warning.code !== 'THIS_IS_UNDEFINED') {
rollupWarn(warning)
}
},
}