diff --git a/package-lock.json b/package-lock.json index 0279f0d2..7e58a69b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -16,15 +16,13 @@ "@json2csv/plainjs": "^7.0.1", "@reduxjs/toolkit": "^1.9.5", "@shlinkio/shlink-frontend-kit": "^0.2.0", - "@shlinkio/shlink-web-component": "^0.1.0", + "@shlinkio/shlink-web-component": "^0.1.1", "bootstrap": "5.2.3", "bottlejs": "^2.0.1", - "chart.js": "^4.3.3", "classnames": "^2.3.2", "compare-versions": "^6.1.0", "csvtojson": "^2.0.10", "date-fns": "^2.30.0", - "leaflet": "^1.9.4", "ramda": "^0.27.2", "react": "^18.2.0", "react-dom": "^18.2.0", @@ -3113,9 +3111,9 @@ } }, "node_modules/@shlinkio/shlink-web-component": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/@shlinkio/shlink-web-component/-/shlink-web-component-0.1.0.tgz", - "integrity": "sha512-3YsvRKZrMKtSlBO0YRi+4MsHGR0Akn8Tl5Akd6yYa6v8NeLjpDDcy7sM+eI/YzXJ9bAHJUost3eJvWNc4cdezw==", + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/@shlinkio/shlink-web-component/-/shlink-web-component-0.1.1.tgz", + "integrity": "sha512-N59LT9KCLPkPvPDPdS5EVvpPg0/eQUf1QuHewVZNK3Ee3XxAqoNK5ssHTuPX/xFDvzPmROEQWxIdcuma5+6e4w==", "dependencies": { "@json2csv/plainjs": "^7.0.1", "bottlejs": "^2.0.1", @@ -13270,9 +13268,9 @@ } }, "@shlinkio/shlink-web-component": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/@shlinkio/shlink-web-component/-/shlink-web-component-0.1.0.tgz", - "integrity": "sha512-3YsvRKZrMKtSlBO0YRi+4MsHGR0Akn8Tl5Akd6yYa6v8NeLjpDDcy7sM+eI/YzXJ9bAHJUost3eJvWNc4cdezw==", + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/@shlinkio/shlink-web-component/-/shlink-web-component-0.1.1.tgz", + "integrity": "sha512-N59LT9KCLPkPvPDPdS5EVvpPg0/eQUf1QuHewVZNK3Ee3XxAqoNK5ssHTuPX/xFDvzPmROEQWxIdcuma5+6e4w==", "requires": { "@json2csv/plainjs": "^7.0.1", "bottlejs": "^2.0.1", diff --git a/package.json b/package.json index 32608760..26e04b80 100644 --- a/package.json +++ b/package.json @@ -32,15 +32,13 @@ "@json2csv/plainjs": "^7.0.1", "@reduxjs/toolkit": "^1.9.5", "@shlinkio/shlink-frontend-kit": "^0.2.0", - "@shlinkio/shlink-web-component": "^0.1.0", + "@shlinkio/shlink-web-component": "^0.1.1", "bootstrap": "5.2.3", "bottlejs": "^2.0.1", - "chart.js": "^4.3.3", "classnames": "^2.3.2", "compare-versions": "^6.1.0", "csvtojson": "^2.0.10", "date-fns": "^2.30.0", - "leaflet": "^1.9.4", "ramda": "^0.27.2", "react": "^18.2.0", "react-dom": "^18.2.0", diff --git a/src/index.tsx b/src/index.tsx index b22c7ac7..9d4cea77 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -1,4 +1,3 @@ -import 'chart.js/auto'; // TODO Import specific ones to reduce bundle size https://react-chartjs-2.js.org/docs/migration-to-v4/#tree-shaking import { createRoot } from 'react-dom/client'; import { Provider } from 'react-redux'; import { BrowserRouter } from 'react-router-dom'; @@ -6,14 +5,10 @@ import pack from '../package.json'; import { container } from './container'; import { setUpStore } from './container/store'; import { register as registerServiceWorker } from './serviceWorkerRegistration'; -import { fixLeafletIcons } from './utils/helpers/leaflet'; import './index.scss'; import 'leaflet/dist/leaflet.css'; import 'react-datepicker/dist/react-datepicker.css'; -// This overwrites icons used for leaflet maps, fixing some issues caused by webpack while processing the CSS -fixLeafletIcons(); - const store = setUpStore(container); const { App, ScrollToTop, ErrorHandler, appUpdateAvailable } = container; diff --git a/src/utils/helpers/leaflet.ts b/src/utils/helpers/leaflet.ts deleted file mode 100644 index df56e3fe..00000000 --- a/src/utils/helpers/leaflet.ts +++ /dev/null @@ -1,14 +0,0 @@ -import L from 'leaflet'; -import marker from 'leaflet/dist/images/marker-icon.png'; -import marker2x from 'leaflet/dist/images/marker-icon-2x.png'; -import markerShadow from 'leaflet/dist/images/marker-shadow.png'; - -export const fixLeafletIcons = () => { - delete (L.Icon.Default.prototype as any)._getIconUrl; // eslint-disable-line no-underscore-dangle - - L.Icon.Default.mergeOptions({ - iconRetinaUrl: marker2x, - iconUrl: marker, - shadowUrl: markerShadow, - }); -}; diff --git a/test/utils/helpers/leaflet.test.ts b/test/utils/helpers/leaflet.test.ts deleted file mode 100644 index e9e37bd9..00000000 --- a/test/utils/helpers/leaflet.test.ts +++ /dev/null @@ -1,19 +0,0 @@ -import L from 'leaflet'; -import marker from 'leaflet/dist/images/marker-icon.png'; -import marker2x from 'leaflet/dist/images/marker-icon-2x.png'; -import markerShadow from 'leaflet/dist/images/marker-shadow.png'; -import { fixLeafletIcons } from '../../../src/utils/helpers/leaflet'; - -describe('leaflet', () => { - describe('fixLeafletIcons', () => { - it('updates icons used by leaflet', () => { - fixLeafletIcons(); - - const { iconRetinaUrl, iconUrl, shadowUrl } = L.Icon.Default.prototype.options; - - expect(iconRetinaUrl).toEqual(marker2x); - expect(iconUrl).toEqual(marker); - expect(shadowUrl).toEqual(markerShadow); - }); - }); -});