Error when importing form components on demand using Vite
HinokiSu opened this issue Β· comments
Hinoki commented
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
kanno 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.
kanno commented
Currently, Form
component can not use rule. It's my mistake.
Hinoki commented
Thank you for your prompt reply.