0

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: '',

Al-76
  • 1,738
  • 6
  • 22
  • 40

2 Answers2

2

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: ''
}
Jeremy Walters
  • 2,081
  • 16
  • 28
  • Ive have read the documentation before but where does it say how to create a vue.config.js? I'm just seeing that it references where it will be if there is one. – Al-76 Jan 18 '19 at 07:44
  • `vue.config.js is an optional config file that will be automatically loaded by @vue/cli-service if it's present in your project root`. Well it says here if in your root it would be loaded automatically. I think its self explanatory that if its not there just create one. – Jeremy Walters Jan 18 '19 at 07:51
  • I don't regard it as self explanatory. It says its optional and will be loaded if present. That doesn't instruct you on how to make one as I was under the impression this may needed to be done via the terminal as there may be more logic under the hood. Then again documentation is not a tutorial. – Al-76 Jan 18 '19 at 08:37
0

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"
};
Mahir Altınkaya
  • 407
  • 6
  • 15