Enable tree shaking for leaflet

This commit is contained in:
James Lyne 2021-01-06 15:14:27 +00:00
parent 6fd43f3f08
commit 416a2963c3
2 changed files with 13 additions and 1 deletions

View File

@ -5,7 +5,8 @@
"scripts": {
"serve": "vue-cli-service serve ",
"build": "vue-cli-service build --report",
"lint": "vue-cli-service lint"
"lint": "vue-cli-service lint",
"postinstall": "node --experimental-modules --experimental-json-modules scripts/fix-leaflet.mjs"
},
"dependencies": {
"core-js": "^3.6.5",

11
scripts/fix-leaflet.mjs Normal file
View File

@ -0,0 +1,11 @@
// @ts-check
import pkgJson from '../node_modules/leaflet/package.json';
import { writeFileSync } from 'fs';
writeFileSync(
'./node_modules/leaflet/package.json',
JSON.stringify({
...pkgJson,
module: 'dist/leaflet-src.esm.js',
}, null, 2));