Skip to content

Commit 1fb3c59

Browse files
EEParkerrstoenescu
authored andcommitted
fix(devserver) Remove "prod" requirement for using publicPath (#4962)
* add option to force publicPath in 'dev' builds * Update quasar-conf-js.md
1 parent a638576 commit 1fb3c59

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

app/lib/quasar-config.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -376,6 +376,7 @@ class QuasarConfig {
376376
webpackManifest: this.ctx.prod,
377377
vueRouterMode: 'hash',
378378
preloadChunks: true,
379+
forceDevPublicPath: false,
379380
// transpileDependencies: [], // leaving here for completeness
380381
devtool: this.ctx.dev
381382
? '#cheap-module-eval-source-map'
@@ -474,7 +475,7 @@ class QuasarConfig {
474475
}
475476

476477
cfg.build.publicPath =
477-
this.ctx.prod && cfg.build.publicPath && ['spa', 'pwa'].includes(this.ctx.modeName)
478+
(this.ctx.prod || cfg.build.forceDevPublicPath) && cfg.build.publicPath && ['spa', 'pwa'].includes(this.ctx.modeName)
478479
? formatPublicPath(cfg.build.publicPath)
479480
: (cfg.build.vueRouterMode !== 'hash' ? '/' : '')
480481

@@ -711,7 +712,7 @@ class QuasarConfig {
711712
}
712713
}
713714
else {
714-
cfg.build.env.__statics = `"${this.ctx.dev ? '/' : cfg.build.publicPath || '/'}statics"`
715+
cfg.build.env.__statics = `"${((this.ctx.prod || cfg.build.forceDevPublicPath) && cfg.build.publicPath) ? cfg.build.publicPath : '/' }statics"`
715716
}
716717

717718
appFilesValidations(cfg)

docs/src/pages/quasar-cli/quasar-conf-js.md

+1
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,7 @@ devServer: {
209209
| 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. |
210210
| 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. |
211211
| 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. |
212+
| 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. |
212213
| 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. |
213214
| htmlFilename | String | Default is 'index.html'. |
214215
| productName | String | Default value is taken from package.json > productName field. |

0 commit comments

Comments
 (0)