vue3使用Vite打包报Rollup failed to resolve import “xxx/node

在使用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的一些组件错误,


解决:

  
  	
  		
  	
  
  
  	import { ref } from 'vue';
    import { Form } from 'ant-design-vue';
	const FormItemRest = Form.ItemRest; //正解
	const val = ref('');
  

本文来自网络,不代表协通编程立场,如若转载,请注明出处:https://net2asp.com/0c0b8ff714.html