Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Drop ESM entrypoint from package #8493

Merged
merged 1 commit into from
Sep 29, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
13 changes: 11 additions & 2 deletions build/rollup-config.js
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
@@ -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.