diff --git a/app/lib/quasar-config.js b/app/lib/quasar-config.js index 6777fad35ce..88393d39df7 100644 --- a/app/lib/quasar-config.js +++ b/app/lib/quasar-config.js @@ -376,6 +376,7 @@ class QuasarConfig { webpackManifest: this.ctx.prod, vueRouterMode: 'hash', preloadChunks: true, + forceDevPublicPath: false, // transpileDependencies: [], // leaving here for completeness devtool: this.ctx.dev ? '#cheap-module-eval-source-map' @@ -474,7 +475,7 @@ class QuasarConfig { } cfg.build.publicPath = - this.ctx.prod && cfg.build.publicPath && ['spa', 'pwa'].includes(this.ctx.modeName) + (this.ctx.prod || cfg.build.forceDevPublicPath) && cfg.build.publicPath && ['spa', 'pwa'].includes(this.ctx.modeName) ? formatPublicPath(cfg.build.publicPath) : (cfg.build.vueRouterMode !== 'hash' ? '/' : '') @@ -711,7 +712,7 @@ class QuasarConfig { } } else { - cfg.build.env.__statics = `"${this.ctx.dev ? '/' : cfg.build.publicPath || '/'}statics"` + cfg.build.env.__statics = `"${((this.ctx.prod || cfg.build.forceDevPublicPath) && cfg.build.publicPath) ? cfg.build.publicPath : '/' }statics"` } appFilesValidations(cfg) diff --git a/docs/src/pages/quasar-cli/quasar-conf-js.md b/docs/src/pages/quasar-cli/quasar-conf-js.md index 24111d6cfb7..c2e6a821ab9 100644 --- a/docs/src/pages/quasar-cli/quasar-conf-js.md +++ b/docs/src/pages/quasar-cli/quasar-conf-js.md @@ -209,6 +209,7 @@ devServer: { | afterBuild({ quasarConf }) | Function | Run hook after Quasar built app for production (`$ quasar build`). At this point, the distributables folder has been created and is available should you wish to do something with it. Can use async/await or directly return a Promise. | | onPublish(opts) | Function | Run hook if publishing was requested (`$ quasar build -P`), after Quasar built app for production and the afterBuild hook (if specified) was executed. Can use async/await or directly return a Promise. `opts` is Object of form `{arg, distDir}`, where "arg" is the argument supplied (if any) to -P parameter. | | publicPath | String | Public path of your app. By default, it uses the root. Use it when your public path is something else, like "<protocol>://<domain>/some/nested/folder" -- in this case, it means the distributables are in "some/nested/folder" on your webserver. | +| forceDevPublicPath | Boolean | Force use of the custom publicPath in dev builds also (only for SPA and PWA modes). Make sure that you know what you are doing. | | vueRouterMode | String | Sets [Vue Router mode](https://router.vuejs.org/en/essentials/history-mode.html): 'hash' or 'history'. Pick wisely. History mode requires configuration on your deployment web server too. | | htmlFilename | String | Default is 'index.html'. | | productName | String | Default value is taken from package.json > productName field. |