Good Afternoon,
I’m trying to develop my first android app using ionic 6 and vue 3, but I’m having this problem:
“Uncaught TypeError: Failed to construct ‘URL’: Invalid base URL” and it refers to my index.js.
This is my index.js code:
// eslint-disable-next-line no-unused-vars
import { createRouter, createWebHistory } from ‘@ionic/vue-router’;
import RenPlus from ‘@/views/ren/RenPlus.vue’;
const routes = [
{
path: ‘’,
redirect: ‘/folder/renplus’
},
{
path: ‘/folder/renplus’,
name: ‘RenPlus’,
component: RenPlus,
},
]
const router = createRouter({
history: createWebHistory(),
routes,
});
console.log(routes)
console.log(‘pippo’)
console.log(process.env.BASE_URL)
export default router;
// const router = createRouter({
// history: createWebHistory(process.env.BASE_URL),
// routes
// })
// const router = createRouter({
// history: createWebHistory(process.env.BASE_URL),
// //linkExactActiveClass: ‘active’,
// linkActiveClass: ‘active’,
// routes,
// });
// router.beforeEach((to, from, next) => {
// const requiresAuth = to.matched.some(record => record.meta.requiresAuth);
// const isAuthenticated = firebase.auth().currentUser;
// console.log(“isauthenticated”, isAuthenticated);
// if (requiresAuth && !isAuthenticated) {
// next(“/login”);
// } else {
// next();
// }
// });
and this is my main.js code:
/* eslint-disable */
import { createApp } from ‘vue’
import App from ‘./App.vue’
import router from ‘./router’;
import { IonicVue } from ‘@ionic/vue’;
/* Core CSS required for Ionic components to work properly */
import ‘@ionic/vue/css/core.css’;
/* Basic CSS for apps built with Ionic */
import ‘@ionic/vue/css/normalize.css’;
import ‘@ionic/vue/css/structure.css’;
import ‘@ionic/vue/css/typography.css’;
/* Optional CSS utils that can be commented out */
import ‘@ionic/vue/css/padding.css’;
import ‘@ionic/vue/css/float-elements.css’;
import ‘@ionic/vue/css/text-alignment.css’;
import ‘@ionic/vue/css/text-transformation.css’;
import ‘@ionic/vue/css/flex-utils.css’;
import ‘@ionic/vue/css/display.css’;
/* Theme variables */
import ‘./theme/variables.css’;
const app = createApp(App)
.use(IonicVue)
.use(router);
app.mount(‘#app’);
// router.isReady().then(() => {
// app.mount(‘#app’);
// });
Thank you!