Al-76
Al-76

Reputation: 1878

How do I update file paths in VueJs if I'm using CLI3

I'm a bit lost and need some help with VueJs. I am using Vue CLI3 and have created a new Vue project where eveything is working, no errors in the console etc. However, after running the build task, the copy in my dist folder shows as a blank page. I have learnt that this is to do with needing to update the assetsPublicPath: and remove the '/' forwards slash. To do this I have been told you have to update the config file index.js but there is no such file in my proect? I have also been told there is a config folder, but there isnt?

Therefore how do I update the following

from assetsPublicPath: '/',

to assetsPublicPath: '',

Upvotes: 0

Views: 194

Answers (2)

Mahir Altınkaya
Mahir Altınkaya

Reputation: 439

Only create a vue.config.js in your project and use inside .File is automatic loaded by vue cli serve. After publish your hosting or server file will must work it.

module.exports = {
  css: {
    extract: true
  },
  publicPath: process.env.NODE_ENV === "production" ? "" : "",
  outputDir: "dist"
};

Upvotes: 0

Jeremy Walters
Jeremy Walters

Reputation: 2152

Take a look at the documentation. If you don't have the vue.config.js just create it. I would look something like this:

// vue.config.js
module.exports = {
  // Any of the config options will come here. Everything you'll need is in the docs
  publicPath: ''
}

Upvotes: 2

Related Questions