Browse Source

perf: optimize bundlesize (#20436)

* 📦 react-slick => @ant-design/react-slick

* 📦 Reduce non-minified dist files size

* 🆙 @ant-design/react-slick
pull/20451/head
偏右 5 years ago
committed by GitHub
parent
commit
2464de1888
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      components/carousel/index.tsx
  2. 3
      package.json
  3. 2
      webpack.config.js

4
components/carousel/index.tsx

@ -1,6 +1,6 @@
import * as React from 'react';
import debounce from 'lodash/debounce';
import { Settings } from 'react-slick';
import { Settings } from '@ant-design/react-slick';
import { ConfigConsumer, ConfigConsumerProps } from '../config-provider';
import warning from '../_util/warning';
@ -8,7 +8,7 @@ import warning from '../_util/warning';
// make sure matchMedia polyfill run before require('react-slick')
// Fix https://github.com/ant-design/ant-design/issues/6560
// Fix https://github.com/ant-design/ant-design/issues/3308
const SlickCarousel = require('react-slick').default;
const SlickCarousel = require('@ant-design/react-slick').default;
export type CarouselEffect = 'scrollx' | 'fade';
export type DotPosition = 'top' | 'bottom' | 'left' | 'right';

3
package.json

@ -90,7 +90,6 @@
],
"dependencies": {
"@ant-design/icons": "^4.0.0-alpha.11",
"@types/react-slick": "^0.23.4",
"array-tree-filter": "^2.1.0",
"classnames": "~2.2.6",
"copy-to-clipboard": "^3.2.0",
@ -131,7 +130,7 @@
"rc-upload": "~3.0.0-alpha.0",
"rc-util": "~4.16.1",
"rc-virtual-list": "^0.0.0-alpha.25",
"react-slick": "~0.25.2",
"@ant-design/react-slick": "~0.25.5",
"resize-observer-polyfill": "^1.5.1",
"scroll-into-view-if-needed": "^2.2.20",
"shallowequal": "^1.1.0",

2
webpack.config.js

@ -49,6 +49,8 @@ if (process.env.RUN_ENV === 'PRODUCTION') {
externalMoment(config);
addLocales(config);
addDarkTheme(config);
// Reduce non-minified dist files size
config.optimization.usedExports = true;
// skip codesandbox ci
if (!process.env.CSB_REPO) {
// https://docs.packtracker.io/uploading-your-webpack-stats/webpack-plugin

Loading…
Cancel
Save