I have A.vue, which imports B and C as follows:
import B from './B.vue'
import C from './C.vue'
export default defineComponent({
components: {B, C},
setup(){
}
});
The console in the browser says:
SyntaxError: The requested module '/node_modules/.vite/vue-router.js?v=13419111' does not provide an export named 'default'
If not importing B and C, the router functions well.
The rule in the router:
{
path: "A",
name: "A",
component: () => import("../components/A.vue"),
},
B and C are simple components whose format is as follows:
export default defineComponent({
setup(){
}
});
Try uninstalling the current vue-router module and reinstall the latest (version 4) one which is compatible with Vue 3 by running :
npm uninstall vue-router
and then
npm install vue-router@next -S
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.