0

I’m experiencing problems deploying a Vue JS app built using the Webpack CLi to work.

If uploaded in a root directory everything renders fine, but inside a subfolder, all the links break.

I want deploy VueJS App to this url : https://event.domain.net/webinar

I have added publicPath in vue.config.js :

var path = require(‘path’)
module.exports = {
   publicPath: ‘./’
}

But only the css and js folders point to the path /webinar.

For assets, fonts and others still point to the subdomain https://event.domain.net.

CSS and JS point to path /webinar

Asset, fonts still point to subdomain https://event.domain.net/

Console

2 Answers 2

2

use value of publicPath as /webinar that should work.

More details are here https://cli.vuejs.org/config/#publicpath

you can configure publicPath even based on environment.

Sign up to request clarification or add additional context in comments.

1 Comment

@Argan did this answer solve your problem?
0

Sagar Rabadiya pointed you to the right link:

  1. create a file called vue.config.js in the project root (where your package.json is located).
  2. prompt the following code snippet inside:
module.exports = {
  publicPath: process.env.NODE_ENV === 'production'? '/your-sub-directory/' : '/'
}

and save the file.

  1. Open a terminal and navigate to your project, then run npm run build to generate a production build from it.
  2. As soon as the production build has been generated, copy the contents from it and paste it in the sub-directory you created in the root folder. For example, if you use Apache, the default root directory is the htdocs folder. I've also created a virtual host on the server, maybe you also need to do this.
  3. Open the browser and type the address where your sub-directory lives. For example: http://your-server-url:your-port/your-sub-directory/ Your should see your app now.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.