Cliff Helsel
Cliff Helsel

Reputation: 940

How can I deploy a Vue app into a subdirectory?

I've got a somewhat involved build pipeline... I am using a static site generator to build my site. This deploys to a "public" directory and is generating the stub inside of an index.html in a generated folder, test.

For example:

mysite/public/test/index.html (contains the div stub for the app).

However, using vue-cli-service build wants to attach the Vue code and app to mysite/public/index.html. I want it instead to update public/test/index.html.

How can I configure this? I'm thinking it might have something to do with the Multi Page App setup, but I'm not technically doing a multi page app. It's really an SPA but living in a subdirectory.

Thanks.

Upvotes: 2

Views: 3254

Answers (1)

tony19
tony19

Reputation: 138696

Vue CLI can be configured with a publicPath to specify a base path where your project will be deployed. For your desired path, create vue.config.js in the root of your project directory, and insert this config:

module.exports = {
  publicPath: '/public/test/'
}

Upvotes: 3

Related Questions