chore: remove babel-plugin-import warning (#37975)

* chore: remove babel-plugin-import warning

* chore: update test case

* chore: code clean
pull/38010/head 5.0.0-alpha.2
MadCcc 2 years ago committed by GitHub
parent 2a9bb7c80e
commit 0d7c87421a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -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();
});
});

@ -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';

@ -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": [

Loading…
Cancel
Save