chore: add env var to use createWebHashHistory
#3313
|
@ -10,4 +10,5 @@
|
|||
# SENTRY_AUTH_TOKEN=YOUR_TOKEN
|
||||
# SENTRY_ORG=vikunja
|
||||
# SENTRY_PROJECT=frontend-oss
|
||||
# VIKUNJA_FRONTEND_BASE=/custom-subpath
|
||||
# VIKUNJA_FRONTEND_BASE=/custom-subpath
|
||||
# VITE_ROUTER_HISTORY_MODE_IS_HASH=false
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { createRouter, createWebHistory } from 'vue-router'
|
||||
import { createRouter, createWebHashHistory, createWebHistory } from 'vue-router'
|
||||
|
||||
import type { RouteLocation } from 'vue-router'
|
||||
import {saveLastVisited} from '@/helpers/saveLastVisited'
|
||||
|
||||
|
@ -81,7 +81,9 @@ const EditTeamComponent = () => import('@/views/teams/EditTeam.vue')
|
|||
const NewTeamComponent = () => import('@/views/teams/NewTeam.vue')
|
||||
|
||||
const router = createRouter({
|
||||
history: createWebHistory(import.meta.env.BASE_URL),
|
||||
history: import.meta.env.VITE_ROUTER_HISTORY_MODE_IS_HASH === 'true'
|
||||
dpschen
commented
So this will be replaced on build time but will still contain the complete import. So this will be replaced on build time but will still contain the complete import.
|
||||
? createWebHashHistory(import.meta.env.BASE_URL)
|
||||
: createWebHistory(import.meta.env.BASE_URL),
|
||||
scrollBehavior(to, from, savedPosition) {
|
||||
// If the user is using their forward/backward keys to navigate, we want to restore the scroll view
|
||||
if (savedPosition) {
|
||||
|
|
Reference in New Issue
Do you know if vite / esbuild is intelligent enough to only bundle only one of those two history implementations imports?
Because the information should be available at build time.
If not could we check if this is possible?
So what I mean is: in case esbuild isn't intelligent enough could we help it via some 'special syntax' ala:
(pseudocode)
and then
Webpack is capable of eliminating unused imports. Not sure about others.