Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Vite re append the antd css stylesheet when use the React lazy load antd component #11455

Closed
7 tasks done
aniude opened this issue Dec 21, 2022 · 2 comments
Closed
7 tasks done

Comments

@aniude
Copy link

aniude commented Dec 21, 2022

Describe the bug

import {lazy} from 'react';
const  pageOne = lazy(() => import('./pageOne');

pageOne.tsx

import {table} from 'antd';

const component:FC = () => {
  <table>... </table>;
}

export default component;

when App.tsx have already import the antd global less include table style, when load the pageOne component, the table style re append again. If I remove the lazy import, the problem is disappear. It make me confuses.

Anyone can fix it?

I found the some issues like #4448

Reproduction

none

Steps to reproduce

No response

System Info

vite 2.9.15.

Used Package Manager

npm

Logs

No response

Validations

@github-actions
Copy link

Hello @aniude. Please provide a minimal reproduction using a GitHub repository or StackBlitz. Issues marked with need reproduction will be closed if they have no activity within 3 days.

@aniude
Copy link
Author

aniude commented Dec 22, 2022

I found that it's about the vite.config.ts

import vitePluginImp from 'vite-plugin-imp';

.... ... 
export default defineConfig({

   ... ....
    vitePluginImp({     // if I only use the plugin-imp for libList empty array, it happened. if I remove this plugin, the problem resolved.
      libList: [],
    }),
});

@aniude aniude closed this as completed Dec 22, 2022
@github-actions github-actions bot locked and limited conversation to collaborators Jan 6, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants