From 0d7c87421a9c6fb1f9b96a54250ef5e287375731 Mon Sep 17 00:00:00 2001 From: MadCcc <1075746765@qq.com> Date: Wed, 12 Oct 2022 19:52:39 +0800 Subject: [PATCH] chore: remove babel-plugin-import warning (#37975) * chore: remove babel-plugin-import warning * chore: update test case * chore: code clean --- components/__tests__/index.test.ts | 8 -------- components/index.tsx | 18 ------------------ package.json | 2 +- 3 files changed, 1 insertion(+), 27 deletions(-) diff --git a/components/__tests__/index.test.ts b/components/__tests__/index.test.ts index bb11ad69f8..9ab8d246ba 100644 --- a/components/__tests__/index.test.ts +++ b/components/__tests__/index.test.ts @@ -1,6 +1,5 @@ const OLD_NODE_ENV = process.env.NODE_ENV; process.env.NODE_ENV = 'development'; -const warnSpy = jest.spyOn(console, 'warn').mockImplementation(() => {}); const antd = require('..'); describe('antd', () => { @@ -11,11 +10,4 @@ describe('antd', () => { it('exports modules correctly', () => { expect(Object.keys(antd)).toMatchSnapshot(); }); - - it('should hint when import all components in dev mode', () => { - expect(warnSpy).toHaveBeenCalledWith( - 'You are using a whole package of antd, please use https://www.npmjs.com/package/babel-plugin-import to reduce app bundle size.', - ); - warnSpy.mockRestore(); - }); }); diff --git a/components/index.tsx b/components/index.tsx index 5b2f138c52..20b8a314bd 100644 --- a/components/index.tsx +++ b/components/index.tsx @@ -1,21 +1,3 @@ -/* @remove-on-es-build-begin */ -// this file is not used if use https://github.com/ant-design/babel-plugin-import -const ENV = process.env.NODE_ENV; -if ( - ENV !== 'production' && - ENV !== 'test' && - typeof console !== 'undefined' && - console.warn && // eslint-disable-line no-console - typeof window !== 'undefined' -) { - // eslint-disable-next-line no-console - console.warn( - 'You are using a whole package of antd, ' + - 'please use https://www.npmjs.com/package/babel-plugin-import to reduce app bundle size.', - ); -} -/* @remove-on-es-build-end */ - export { default as Affix } from './affix'; export type { AffixProps } from './affix'; export { default as Alert } from './alert'; diff --git a/package.json b/package.json index c8daf14753..195f9c1bcd 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "antd", - "version": "5.0.0-alpha.1", + "version": "5.0.0-alpha.2", "description": "An enterprise-class UI design language and React components implementation", "title": "Ant Design", "keywords": [