mirror of
https://github.com/Leaflet/Leaflet.git
synced 2025-08-16 16:45:22 +00:00
add pkg.module (#6021)
* add pkg.module version * get tests to pass * export noConflict
This commit is contained in:

committed by
Vladimir Agafonkin

parent
d3175e807f
commit
d188cc5ede
@ -3,8 +3,9 @@
|
||||
import rollupGitVersion from 'rollup-plugin-git-version'
|
||||
import json from 'rollup-plugin-json'
|
||||
import gitRev from 'git-rev-sync'
|
||||
import pkg from '../package.json'
|
||||
|
||||
let version = require('../package.json').version;
|
||||
let {version} = pkg;
|
||||
let release;
|
||||
|
||||
// Skip the git branch+rev in the banner when doing a release build
|
||||
@ -23,15 +24,33 @@ const banner = `/* @preserve
|
||||
*/
|
||||
`;
|
||||
|
||||
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;`;
|
||||
|
||||
export default {
|
||||
input: 'src/Leaflet.js',
|
||||
output: {
|
||||
file: 'dist/leaflet-src.js',
|
||||
format: 'umd',
|
||||
name: 'L',
|
||||
banner: banner,
|
||||
sourcemap: true
|
||||
},
|
||||
output: [
|
||||
{
|
||||
file: pkg.main,
|
||||
format: 'umd',
|
||||
name: 'L',
|
||||
banner: banner,
|
||||
outro: outro,
|
||||
sourcemap: true
|
||||
},
|
||||
{
|
||||
file: pkg.module,
|
||||
format: 'es',
|
||||
banner: banner,
|
||||
sourcemap: true
|
||||
}
|
||||
],
|
||||
legacy: true, // Needed to create files loadable by IE8
|
||||
plugins: [
|
||||
release ? json() : rollupGitVersion()
|
||||
|
@ -32,6 +32,7 @@
|
||||
"uglify-js": "~3.0.26"
|
||||
},
|
||||
"main": "dist/leaflet-src.js",
|
||||
"module": "dist/leaflet-src.esm.js",
|
||||
"style": "dist/leaflet.css",
|
||||
"files": [
|
||||
"dist",
|
||||
|
@ -1,5 +1,14 @@
|
||||
var json = require('rollup-plugin-json');
|
||||
|
||||
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;`;
|
||||
|
||||
// Karma configuration
|
||||
module.exports = function (config) {
|
||||
|
||||
@ -50,7 +59,8 @@ module.exports = function (config) {
|
||||
json()
|
||||
],
|
||||
format: 'umd',
|
||||
name: 'L'
|
||||
name: 'L',
|
||||
outro: outro
|
||||
},
|
||||
|
||||
// test results reporter to use
|
||||
|
@ -23,16 +23,5 @@ export * from './layer/index';
|
||||
// map
|
||||
export * from './map/index';
|
||||
|
||||
// misc
|
||||
|
||||
var oldL = window.L;
|
||||
export function noConflict() {
|
||||
window.L = oldL;
|
||||
return this;
|
||||
}
|
||||
|
||||
// Always export us to window global (see #2364)
|
||||
window.L = exports;
|
||||
|
||||
import {freeze} from './core/Util';
|
||||
Object.freeze = freeze;
|
||||
|
Reference in New Issue
Block a user