diff --git a/.fatherrc.ts b/.fatherrc.ts index 5ee1b0df1a..84fd4cc69d 100644 --- a/.fatherrc.ts +++ b/.fatherrc.ts @@ -26,10 +26,10 @@ export default (name: string) => { externals: { '@antv/s2': 'S2', antd: 'antd', + 'ant-design-vue': 'antd', react: 'React', 'react-dom': 'ReactDOM', vue: 'Vue', - 'ant-design-vue': 'AntDesignVue', }, }, }); diff --git a/build.config.base.mjs b/build.config.base.mjs index 3836f7ec3e..5007adb5d1 100644 --- a/build.config.base.mjs +++ b/build.config.base.mjs @@ -1,6 +1,7 @@ /* eslint-disable max-lines-per-function */ /* eslint-disable import/order */ import { viteCommonjs } from '@originjs/vite-plugin-commonjs'; +import { toLower } from 'lodash'; import path from 'path'; import peerDepsExternal from 'rollup-plugin-peer-deps-external'; import { visualizer } from 'rollup-plugin-visualizer'; @@ -27,20 +28,6 @@ export const getBaseConfig = () => { ), }; - const output = { - dir: outDir, - entryFileNames: `[name]${isUMD ? '.min' : ''}.js`, - assetFileNames: `[name]${isUMD ? '.min' : ''}.[ext]`, - globals: { - vue: 'Vue', - react: 'React', - 'react-dom': 'ReactDOM', - '@antv/s2': 'S2', - '@antv/s2-react': 'S2React', - lodash: '_', - }, - }; - const resolve = { mainFields: ['src', 'module', 'main'], alias: [ @@ -63,10 +50,6 @@ export const getBaseConfig = () => { find: /^@antv\/s2$/, replacement: path.join(__dirname, './packages/s2-core/src'), }, - { - find: /^@antv\/s2\/shared$/, - replacement: path.join(__dirname, './packages/s2-core/src/shared'), - }, ], ); } @@ -74,6 +57,8 @@ export const getBaseConfig = () => { const getViteConfig = ( { port, libName, plugins } = { port: 3001, plugins: [] }, ) => { + const filename = isUMD ? `${toLower(libName)}.min` : '[name]'; + return { server: { port, @@ -126,7 +111,19 @@ export const getBaseConfig = () => { }, outDir, rollupOptions: { - output, + output: { + dir: outDir, + entryFileNames: `${filename}.js`, + assetFileNames: `${filename}.[ext]`, + globals: { + vue: 'Vue', + react: 'React', + 'react-dom': 'ReactDOM', + '@antv/s2': 'S2', + '@antv/s2-react': 'S2React', + lodash: '_', + }, + }, }, }, }; @@ -140,7 +137,6 @@ export const getBaseConfig = () => { resolve, isAnalysisMode, outDir, - output, OUT_DIR_NAME_MAP, isDevMode, isUMD, diff --git a/packages/s2-core/package.json b/packages/s2-core/package.json index 752a5ff748..5e5b355b68 100644 --- a/packages/s2-core/package.json +++ b/packages/s2-core/package.json @@ -92,7 +92,7 @@ { "path": "./dist/s2.min.js", "import": "{ createComponent }", - "limit": "230 kB" + "limit": "240 kB" }, { "path": "./dist/s2.min.css", diff --git a/packages/s2-react-components/package.json b/packages/s2-react-components/package.json index f9ae8a7be7..02fb877dcb 100644 --- a/packages/s2-react-components/package.json +++ b/packages/s2-react-components/package.json @@ -108,8 +108,9 @@ { "path": "./dist/s2-react-components.min.js", "import": "{ createComponent }", - "limit": "80 kB", + "limit": "110 kB", "ignore": [ + "antd", "S2", "React", "ReactDOM" diff --git a/packages/s2-react/package.json b/packages/s2-react/package.json index 124325de69..a7ccf11e0d 100644 --- a/packages/s2-react/package.json +++ b/packages/s2-react/package.json @@ -96,7 +96,7 @@ { "path": "./dist/s2-react.min.js", "import": "{ createComponent }", - "limit": "25 kB", + "limit": "45 kB", "ignore": [ "S2", "React", diff --git a/packages/s2-vue/package.json b/packages/s2-vue/package.json index d99d1debb4..02ddcdb093 100644 --- a/packages/s2-vue/package.json +++ b/packages/s2-vue/package.json @@ -80,17 +80,17 @@ }, "size-limit": [ { - "path": "./dist/s2-vue.min.js", + "path": "./dist/index.min.js", "import": "{ createComponent }", "limit": "35 kB", "ignore": [ "S2", "Vue", - "AntDesignVue" + "antd" ] }, { - "path": "./dist/s2-vue.min.css", + "path": "./dist/style.min.css", "limit": "5 kB" } ],