forked from Leaflet/Leaflet
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrollup-config.js
54 lines (49 loc) · 1.23 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
// Config file for running Rollup
import rollupGitVersion from 'rollup-plugin-git-version';
import json from '@rollup/plugin-json';
import gitRev from 'git-rev-sync';
import pkg from '../package.json';
import {createBanner} from './banner';
const release = process.env.NODE_ENV === 'release';
const watch = process.argv.indexOf('-w') > -1 || process.argv.indexOf('--watch') > -1;
// Skip the git branch+rev in the banner when doing a release build
const version = release ? pkg.version : `${pkg.version}+${gitRev.branch()}.${gitRev.short()}`;
const banner = createBanner(version);
const outro = `var oldL = window.L;
exports.noConflict = function() {
window.L = oldL;
return this;
}
// Always export us to window global (see #2364)
window.L = exports;`;
/** @type {import('rollup').RollupOptions} */
const config = {
input: 'src/Leaflet.js',
output: [
{
file: pkg.main,
format: 'umd',
name: 'leaflet',
banner: banner,
outro: outro,
sourcemap: true,
freeze: false,
esModule: false
}
],
plugins: [
release ? json() : rollupGitVersion()
]
};
if (!watch) {
config.output.push(
{
file: 'dist/leaflet-src.esm.js',
format: 'es',
banner: banner,
sourcemap: true,
freeze: false
}
);
}
export default config;