Skip to content

fix(devserver) Remove "prod" requirement for using publicPath #4962

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Aug 30, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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"`
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I switched the logic here to match L478.

}

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 public path in dev builds. By default, dev uses `/` for the public path. Use this setting to force use of `publicPath` for `base` tag and `statics` folder. |
| 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