Skip to content

Commit

Permalink
fix(devserver) Remove "prod" requirement for using publicPath (#4962)
Browse files Browse the repository at this point in the history
* add option to force publicPath in 'dev' builds

* Update quasar-conf-js.md
  • Loading branch information
EEParker authored and rstoenescu committed Aug 30, 2019
1 parent a638576 commit 1fb3c59
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
5 changes: 3 additions & 2 deletions app/lib/quasar-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down Expand Up @@ -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' ? '/' : '')

Expand Down Expand Up @@ -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)
Expand Down
1 change: 1 addition & 0 deletions docs/src/pages/quasar-cli/quasar-conf-js.md
Original file line number Diff line number Diff line change
Expand Up @@ -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. |
Expand Down

0 comments on commit 1fb3c59

Please sign in to comment.