Skip to content

Commit

Permalink
Drop ESM entrypoint from package (#8493)
Browse files Browse the repository at this point in the history
  • Loading branch information
jonkoops committed Sep 29, 2022
1 parent 822e557 commit fc481fd
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 50 deletions.
13 changes: 11 additions & 2 deletions build/rollup-config.js
Expand Up @@ -12,15 +12,24 @@ const watch = process.argv.indexOf('-w') > -1 || process.argv.indexOf('--watch')
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/LeafletWithGlobals.js',
input: 'src/Leaflet.js',
output: [
{
file: pkg.main,
format: 'umd',
name: 'leaflet',
banner: banner,
outro: outro,
sourcemap: true,
freeze: false,
esModule: false
Expand All @@ -34,7 +43,7 @@ const config = {
if (!watch) {
config.output.push(
{
file: pkg.module,
file: 'dist/leaflet-src.esm.js',
format: 'es',
banner: banner,
sourcemap: true,
Expand Down
19 changes: 0 additions & 19 deletions debug/tests/esm.html

This file was deleted.

4 changes: 1 addition & 3 deletions package.json
Expand Up @@ -33,7 +33,6 @@
"uglify-js": "^3.17.0"
},
"main": "dist/leaflet-src.js",
"module": "dist/leaflet-src.esm.js",
"style": "dist/leaflet.css",
"files": [
"dist",
Expand Down Expand Up @@ -70,8 +69,7 @@
],
"root": true,
"globals": {
"L": true,
"globalThis": true
"L": true
},
"env": {
"commonjs": true,
Expand Down
14 changes: 12 additions & 2 deletions spec/karma.conf.js
@@ -1,13 +1,22 @@
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) {

// var libSources = require(__dirname + '/../build/build.js').getFiles();

var files = [
"spec/before.js",
"src/LeafletWithGlobals.js",
"src/Leaflet.js",
"spec/after.js",
"node_modules/happen/happen.js",
"node_modules/prosthetic-hand/dist/prosthetic-hand.js",
Expand All @@ -19,7 +28,7 @@ module.exports = function (config) {

var preprocessors = {};

preprocessors['src/LeafletWithGlobals.js'] = ['rollup'];
preprocessors['src/Leaflet.js'] = ['rollup'];

config.set({
// base path, that will be used to resolve files and exclude
Expand Down Expand Up @@ -55,6 +64,7 @@ module.exports = function (config) {
output: {
format: 'umd',
name: 'leaflet',
outro: outro,
freeze: false,
},
},
Expand Down
24 changes: 0 additions & 24 deletions src/LeafletWithGlobals.js

This file was deleted.

0 comments on commit fc481fd

Please sign in to comment.