Skip to content
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

Allow custom 'publicPath' config #354

Merged
merged 3 commits into from
Nov 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
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
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,12 @@ npm run lint:fix

See [Configuration Reference](https://cli.vuejs.org/config/).

### ENV VARs

Besides the environment variables supported by Vue CLI Wegue offers the following ENV VARs:

- `WGU_PUBLIC_PATH` allows to modify the [publicPath](https://cli.vuejs.org/config/#publicpath) Vue CLI configuration, which is used in the production build. Default of `publicPath` is `'./'`.

## Run with Docker

Versioned Docker images are available on [DockerHub](https://hub.docker.com/r/meggsimum/wegue/tags).
Expand Down
13 changes: 13 additions & 0 deletions docs/workshop.md
Original file line number Diff line number Diff line change
Expand Up @@ -1004,3 +1004,16 @@ npm run build
```

Now, you can move the contents of the `dist` directory to a web space and it can be seen online.

### Modify deployment path (publicPath)

In case you want to deploy your app somewhere else than at the root of a domain, e.g. in a sub-path like https://www.foobar.com/my-app/,
you will need to specify that sub-path for the production build. This can be done by using the custom Wegue ENV VAR `WGU_PUBLIC_PATH`:

```bash
WGU_PUBLIC_PATH=/my-app/
```

For more information see [publicPath VUE CLI documentation](https://cli.vuejs.org/config/#publicpath).

Note: The default of `publicPath` is `'./'`, which should work for a lot of common scenarios.
1 change: 1 addition & 0 deletions vue.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ const { defineConfig } = require('@vue/cli-service')
*/
module.exports = defineConfig({
assetsDir: 'static',
publicPath: process.env.WGU_PUBLIC_PATH || './',
runtimeCompiler: true,
pages: {
app: {
Expand Down