-
-
Notifications
You must be signed in to change notification settings - Fork 19.9k
[Component] [watermark] watermark水印组件引用报错 #14560
Description
Bug Type: Component
Environment
- Vue Version:
3.3.4 - Element Plus Version:
2.4.0 - Browser / OS:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/117.0.0.0 Safari/537.36 - Build Tool:
Vite
Reproduction
Related Component
el-watermark
Reproduction Link
Steps to reproduce
What is Expected?
What is actually happening?
Additional comments
vite.config.ts 配置
export default ({ mode }: { mode: string }) => {
const plugins: PluginOption[] = [
vue(),
Components({
resolvers: [ElementPlusResolver()]
})
]
const env = loadEnv(mode, './')
return defineConfig({
plugins,
css: {
postcss: {
plugins: [autoprefixer]
}
},
resolve: {
alias: {
'@': fileURLToPath(new URL('./src', import.meta.url))
}
},
build: {
assetsDir: 'static',
rollupOptions: {
output: {
manualChunks: splitVendorChunk
}
}
},
experimental: {
renderBuiltUrl(filename: string, { type }: { hostId: string; hostType: 'js' | 'css' | 'html'; type: 'public' | 'asset' }) {
if (type === 'public') {
return '/' + filename
} else {
return env.VITE_CDN_PATH + filename
}
}
},
test: {
globals: true,
environment: 'jsdom',
coverage: {
provider: 'istanbul'
}
}
})
}
报错信息:
[plugin:vite:import-analysis] Failed to resolve import "element-plus/es/components/watermark/style/css" from "src/pages/home/HomeView.vue". Does the file exist?
/**/HomeView.vue:1:171
1 | / unplugin-vue-components disabled */import { ElWatermark as __unplugin_components_0 } from 'element-plus/es';import 'element-plus/es/components/base/style/css';import 'element-plus/es/components/watermark/style/css';
| ^
2 | import { defineComponent } from "vue";
3 | const _sfc_main = defineComponent({});
