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

2 Answers 2

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: ''
}
Sign up to request clarification or add additional context in comments.

3 Comments

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.
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.
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.
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"
};

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.