fect-org / fect

Minimalist UI components built on Vue-next

Home Page:https://www.fect-org.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Error when importing form components on demand using Vite

HinokiSu opened this issue Β· comments

Bug report 🐞

Error when importing form components on demand using Vite

import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import styleImport from 'vite-plugin-style-import'

// https://vitejs.dev/config/
export default defineConfig({
  plugins: [
    vue(),
    styleImport({
      libs: [
        {
          libraryName: '@fect-ui/vue',
          esModule: true,
          resolveStyle: (name) => `@fect-ui/vue/es/${name}/index.css`
        }
      ]
    })
  ]
})

temporary method

 libs: [
        {
          libraryName: '@fect-ui/vue',
          esModule: true,
          resolveStyle: (name) => {
            if (name === 'form') {
              return
            } else {
              return `@fect-ui/vue/es/${name}/index.css`
            }
          },
        },
      ],

Version & Environment

"@fect-ui/vue": "1.2.4",
"vue": "^3.2.25",

Expection

no error

Actual results (or Errors)

[vite] Internal server error: Failed to resolve import "F:/**path**/node_modules/.pnpm/
registry.npmmirror.com+@fect-ui+vue@1.2.4_vue@3.2.26/node_modules/@fect-ui/vue/es/form/index.css" from "src\plugins\ui.ts". 
Does the file exist?
  Plugin: vite:import-analysis
commented

The file does not exist. The form component was not fully implemented because I was too busy before. And I will complete the form component in subsequent versions. you can enable ensureStyleFile in vite-plugin-style-import to temporarily solve this problem.

commented

Currently, Form component can not use rule. It's my mistake.

Thank you for your prompt reply.