Skip to content

Commit

Permalink
Merge pull request #354 from chrismayer/public-path
Browse files Browse the repository at this point in the history
Allow custom 'publicPath' config
  • Loading branch information
chrismayer authored Nov 9, 2023
2 parents b0d5575 + 553585e commit e5f69df
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 0 deletions.
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

0 comments on commit e5f69df

Please sign in to comment.