I'm new to VueJS and created a project with hash routing. Is there a way to change it to history mode (v2.x)?
I tried the following:
const router = new VueRouter({
mode: 'history',
routes: [...]
})
and
const router = createRouter({
history: createWebHistory(),
routes
})
But they won't work. The fisrt one just doesn't do anything, and the second one just triggers some warnings on the CLI.
WARNING Compiled with 2 warnings 9:14:51
warning in ./src/router/index.js
export 'createRouter' (imported as 'createRouter') was not found in 'vue-router' (possible exports: NavigationFailureType, RouterLink, RouterView, START_LOCATION, default, isNavigationFailure, version)
warning in ./src/router/index.js
export 'createWebHistory' (imported as 'createWebHistory') was not found in 'vue-router' (possible exports: NavigationFailureType, RouterLink, RouterView, START_LOCATION, default, isNavigationFailure, version)