Skip to content

Commit

Permalink
chore: 调整 size-limit
Browse files Browse the repository at this point in the history
  • Loading branch information
lijinke666 committed Sep 25, 2024
1 parent c0db6fd commit d962ae7
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 27 deletions.
2 changes: 1 addition & 1 deletion .fatherrc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
},
},
});
Expand Down
36 changes: 16 additions & 20 deletions build.config.base.mjs
Original file line number Diff line number Diff line change
@@ -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';
Expand All @@ -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: [
Expand All @@ -63,17 +50,15 @@ 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'),
},
],
);
}

const getViteConfig = (
{ port, libName, plugins } = { port: 3001, plugins: [] },
) => {
const filename = isUMD ? `${toLower(libName)}.min` : '[name]';

return {
server: {
port,
Expand Down Expand Up @@ -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: '_',
},
},
},
},
};
Expand All @@ -140,7 +137,6 @@ export const getBaseConfig = () => {
resolve,
isAnalysisMode,
outDir,
output,
OUT_DIR_NAME_MAP,
isDevMode,
isUMD,
Expand Down
2 changes: 1 addition & 1 deletion packages/s2-core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@
{
"path": "./dist/s2.min.js",
"import": "{ createComponent }",
"limit": "230 kB"
"limit": "240 kB"
},
{
"path": "./dist/s2.min.css",
Expand Down
3 changes: 2 additions & 1 deletion packages/s2-react-components/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,9 @@
{
"path": "./dist/s2-react-components.min.js",
"import": "{ createComponent }",
"limit": "80 kB",
"limit": "110 kB",
"ignore": [
"antd",
"S2",
"React",
"ReactDOM"
Expand Down
2 changes: 1 addition & 1 deletion packages/s2-react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@
{
"path": "./dist/s2-react.min.js",
"import": "{ createComponent }",
"limit": "25 kB",
"limit": "45 kB",
"ignore": [
"S2",
"React",
Expand Down
6 changes: 3 additions & 3 deletions packages/s2-vue/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
],
Expand Down

0 comments on commit d962ae7

Please sign in to comment.