From da7819f6c552a3ecf109bac306ce5c0c9ae7039f Mon Sep 17 00:00:00 2001 From: lvisei Date: Tue, 16 Apr 2024 20:49:56 +0800 Subject: [PATCH 1/3] =?UTF-8?q?build:=20mpas=20=E5=8C=85=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=20umd=20=E4=BA=A7=E7=89=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/maps/.fatherrc.ts | 38 ++++++++++++++++++++++++++++++++++++++ packages/maps/package.json | 5 ++++- 2 files changed, 42 insertions(+), 1 deletion(-) diff --git a/packages/maps/.fatherrc.ts b/packages/maps/.fatherrc.ts index 30c9bda016..6c2bf50ed1 100644 --- a/packages/maps/.fatherrc.ts +++ b/packages/maps/.fatherrc.ts @@ -1,10 +1,48 @@ +import type { IFatherConfig } from 'father'; import { defineConfig } from 'father'; +import { BundleAnalyzerPlugin } from 'webpack-bundle-analyzer'; const isProduction = process.env.NODE_ENV === 'production'; +const umdConfig: IFatherConfig['umd'] = { + name: 'L7Maps', + output: { + path: './dist', + filename: 'l7-maps.min.js', + }, + platform: 'browser', + targets: { ie: 11 }, + externals: { + 'mapbox-gl': { + root: 'mapboxgl', + commonjs: 'mapbox-gl', + commonjs2: 'mapbox-gl', + amd: 'mapbox-gl', + }, + 'maplibre-gl': { + root: 'maplibregl', + commonjs: 'maplibre-gl', + commonjs2: 'maplibre-gl', + amd: 'maplibre-gl', + }, + }, + chainWebpack(memo) { + // 关闭压缩方便调试,默认开启 + // memo.optimization.minimize(false); + + // 打包体积分析 + memo + .plugin('webpack-bundle-analyzer') + .use(BundleAnalyzerPlugin, [{ analyzerMode: 'static', openAnalyzer: false }]); + + return memo; + }, +}; + export default defineConfig({ extends: '../../.fatherrc.base.ts', // 使用 babel 编译 esm/cjs 产物,启用 transform-import-css-l7 插件完成 CSS 内联打包 esm: { transformer: 'babel' }, cjs: isProduction ? { transformer: 'babel' } : undefined, + umd: isProduction ? umdConfig : undefined, }); diff --git a/packages/maps/package.json b/packages/maps/package.json index aa8e6991c7..4fe224b9a7 100644 --- a/packages/maps/package.json +++ b/packages/maps/package.json @@ -8,11 +8,14 @@ "**/*.css" ], "main": "lib/index.js", + "unpkg": "dist/l7-maps.min.js", "module": "es/index.js", "types": "es/index.d.ts", "files": [ + "dist", "lib", - "es" + "es", + "!dist/report.html" ], "scripts": { "dev": "father dev", From 5255eb19a661f513d33e09fdfa3a775fde620e25 Mon Sep 17 00:00:00 2001 From: lvisei Date: Tue, 16 Apr 2024 20:50:58 +0800 Subject: [PATCH 2/3] chore: add changeset --- .changeset/honest-poems-live.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/honest-poems-live.md diff --git a/.changeset/honest-poems-live.md b/.changeset/honest-poems-live.md new file mode 100644 index 0000000000..616ae3578b --- /dev/null +++ b/.changeset/honest-poems-live.md @@ -0,0 +1,5 @@ +--- +'@antv/l7-maps': patch +--- + +build: mpas 包添加 umd 产物 From 5f59d475107daf6b300615f2d8414da45068c710 Mon Sep 17 00:00:00 2001 From: lvisei Date: Tue, 16 Apr 2024 21:09:39 +0800 Subject: [PATCH 3/3] test: sleepTime --- __tests__/integration/line.spec.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/__tests__/integration/line.spec.ts b/__tests__/integration/line.spec.ts index 9344f838b0..a70793f62f 100644 --- a/__tests__/integration/line.spec.ts +++ b/__tests__/integration/line.spec.ts @@ -3,6 +3,7 @@ import { generateCanvasTestCases } from './utils/generator'; const TEST_CASES = [ { name: 'arc', + sleepTime: 500, }, { name: 'arc_plane', @@ -11,10 +12,11 @@ const TEST_CASES = [ { name: 'flow', - sleepTime: 500, + sleepTime: 800, }, { name: 'arc', + sleepTime: 600, }, { name: 'dash',