Relative publicPath with history router mode adds prefix '/' to base href
See original GitHub issueDescribe the bug
When setting publicPath
to ‘./’ and using history router mode, the base href
inserted into the html contains an extra prefix /
.
This means that I cannot deploy my application to a dynamic environment where it will be hosted at both www.example.com
and www.someotherexample.com/apath
.
To Reproduce Steps to reproduce the behavior:
- Configure
vueRouterMode
to'history'
in quasar.conf.js - Configure
publicPath
to'./'
, or'.'
or''
in quasar.conf.js - Run project
Expected behavior
I expect the <base href
to contain a relative path.
Screenshots
Platform (please complete the following information): Quasar Version: @quasar/app Version: Quasar mode: [X] SPA [ ] SSR [ ] PWA [ ] Electron [ ] Cordova [ ] Capacitor [ ] BEX Tested on: [X] SPA [ ] SSR [ ] PWA [ ] Electron [ ] Cordova [ ] Capacitor [ ] BEX OS: Mac Node: 10.23 NPM: 6.14.11 Yarn: Not installed Browsers: Firefox, Chrome iOS: Android: Electron:
❯ quasar info
Operating System - Darwin(19.6.0) - darwin/x64
NodeJs - 10.23.0
Global packages
NPM - 6.14.11
yarn - Not installed
@quasar/cli - 1.1.3
@quasar/icongenie - Not installed
cordova - Not installed
Important local packages
quasar - 1.15.4 -- Build high-performance VueJS user interfaces (SPA, PWA, SSR, Mobile and Desktop) in record time
@quasar/app - 2.1.15 -- Quasar Framework local CLI
@quasar/extras - 1.9.17 -- Quasar Framework fonts, icons and animations
eslint-plugin-quasar - Not installed
vue - 2.6.12 -- Reactive, component-oriented view layer for modern web interfaces.
vue-router - 3.2.0 -- Official router for Vue.js 2
vuex - 3.6.0 -- state management for Vue.js
electron - Not installed
electron-packager - Not installed
electron-builder - Not installed
@babel/core - 7.12.17 -- Babel compiler core.
webpack - 4.44.2 -- Packs CommonJs/AMD modules for the browser. Allows to split your codebase into multiple bundles, which can be loaded on demand. Support loaders to preprocess files, i.e. json, jsx, es7, css, less, ... and your custom stuff.
webpack-dev-server - 3.11.0 -- Serves a webpack app. Updates the browser on changes.
workbox-webpack-plugin - Not installed
register-service-worker - 1.7.1 -- Script for registering service worker, with hooks
typescript - 3.9.5 -- TypeScript is a language for application scale JavaScript development
@capacitor/core - Not installed
@capacitor/cli - Not installed
@capacitor/android - Not installed
@capacitor/ios - Not installed
Additional context
Issue #4451 describes the same issue but with full urls. The fix in commit f70bf797301002fc9c0f0403a44c574dc2559062 only seems to respect http
paths. It is obvious from looking at the code that any path not starting with a /
will get a leading /
. Even passing in null
or ‘empty string’, ends up with a base href
of /
.
Perhaps this is by design and this scenario is not supported?
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:9
Top GitHub Comments
Adding the following to
build
in myquasar.config.js
file resolved this issue for me:This is if you are using
vite
.@eyedean I don’t completely agree on that, the architectural context was provided to depict the use case where we are facing that issue. But regardless from the architectural context there is a mismatch in the behavior from vuejs cli and quasar cli where quasar seems to be explicitly avoiding relative public paths.
See https://cli.vuejs.org/config/#publicpath where its stated
publicPath
can also be relative. After testing both vanilla vue cli withpublicPath: '.'
the generated paths on vue cli arehref="css/app.xxx.css"
and on quasar clihref="/./css/app.xxx.css"
So my main question regarding quasar’s behavior would be, is there a reason why a relative
publicPath
is being explicitly avoided and therefore behaving differently that vanilla VueJS cli?