在使用vue3 + vite + ant design vue 的时候,引入一些antd的一些组件的时候,通常运行是没有错的,但是打包会报错,例如:
Rollup failed to resolve import "D:/xxxxx/node_modules/ant-design-vue/es/form-item-rest/style/index" from "src/views/xxx/xxx.vue". 15:01:51 This is most likely unintended because it can break your application at runtime. If you do want to externalize this module explicitly add it to build.rollupOptions.external
报关于 ant design vue的一些组件错误,文章来源:https://www.toymoban.com/news/detail-568228.html
解决:文章来源地址https://www.toymoban.com/news/detail-568228.html
<template>
<FormItemRest>
<a-input v-moal:value='val' />
</FormItemRest>
</template>
<script lang='ts' setup>
import { ref } from 'vue';
import { Form } from 'ant-design-vue';
const FormItemRest = Form.ItemRest; //正解
const val = ref('');
</script>
到了这里,关于vue3使用Vite打包报Rollup failed to resolve import “xxx/node_modules/ant-design-vue/xxxx的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!