From 64114d594042bd63f0dd3878d6fef31bdca7d245 Mon Sep 17 00:00:00 2001 From: James Barnett Date: Fri, 1 Aug 2025 22:03:50 +0100 Subject: Tree-shake chart imports. Minify bundle and generate sourcemaps. --- src/ui/benchmarkCharts.ts | 15 +++++++++++++-- webpack.config.js | 5 ++++- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/src/ui/benchmarkCharts.ts b/src/ui/benchmarkCharts.ts index d272567..ad8cf4b 100644 --- a/src/ui/benchmarkCharts.ts +++ b/src/ui/benchmarkCharts.ts @@ -1,6 +1,17 @@ -import * as echarts from 'echarts'; -import {EChartsOption, EChartsType} from "echarts"; +import * as echarts from 'echarts/core'; +import {EChartsOption} from "echarts"; +import { CanvasRenderer } from 'echarts/renderers'; +import { BarChart } from 'echarts/charts'; +import { GridComponent, LegendComponent, DatasetComponent} from 'echarts/components'; +echarts.use([ + BarChart, + CanvasRenderer, + GridComponent, + LegendComponent, + DatasetComponent +]); +type EChartsType = ReturnType; let scoreChart: EChartsType; const userDeviceLabel = 'Your device'; diff --git a/webpack.config.js b/webpack.config.js index 1162afd..84cf57f 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -3,7 +3,7 @@ const CopyPlugin = require('copy-webpack-plugin'); module.exports = { entry: './src/ui/index.ts', - devtool: 'inline-source-map', + devtool: 'source-map', module: { rules: [ { @@ -21,6 +21,9 @@ module.exports = { path: path.resolve(__dirname, 'dist'), clean: true }, + optimization: { + minimize: true + }, plugins: [ new CopyPlugin({ patterns: [ -- cgit v1.2.3