onebay / vite-plugin-imp

A vite plugin for import library component style automatic.
MIT License
232 stars 24 forks source link

fusion design in vite project that can't be built #30

Closed csfankun closed 2 years ago

csfankun commented 2 years ago

Describe the bug

[@alifd/next] vite project import fusion design UI framework,then get mistake node_modules/@alifd/next/types/drawer/index.d.ts:13:18 - error TS2430: Interface 'DrawerProps' incorrectly extends interface 'HTMLAttributesWeak'. Types of property 'onVisibleChange' are incompatible. Type '((visible: boolean, reason: string) => void) | undefined' is not assignable to type '((visible: boolean, type: string | object, e?: {} | undefined) => void) | undefined'.

Libarary Info(please complete the following information): Libarary: [@alifd/next]

To Reproduce Steps to reproduce the behavior:
1、pls. take a look at this online demo https://stackblitz.com/edit/vitejs-vite-ajpyen?file=src%2FApp.tsx 2、open a new terminal to run "npm run build",then you will see the mistake info

Expected behavior when run "npm run build",there is no mistake and can packaged ok

Error message Paste the error message here.

Additional context Add any other context about the problem here.

psaren commented 2 years ago

The build failure is not related to vite-plugin-imp
you can try to comment out vite-plugin-imp and run npm run build

export default defineConfig({
  plugins: [
    react(),
    // vitePluginImp({
    //   libList: [
    //     {
    //       libName: '@alifd/next',
    //       style: (name: string) => {
    //         return `@alifd/next/es/${name}/index.css`;
    //       },
    //     },
    //   ],
    // }),
  ],
});

it will get the some error.

I guess this is a related with @alifd/next

if you want to avoid this error, you can try to modify the build script in package.json to:

"build": "vite build"

just remove tsc and it will build successfully.

The better way is to modify skipLibCheck to true in tsconfig.json. https://stackblitz.com/edit/vitejs-vite-9joyzd?file=tsconfig.json