2

A little background..

As mentioned before in https://forum.vuejs.org/t/how-to-make-webpack-vue-work-on-xampp/33808. And it works when I put my Vue project directly in htdocs like this.

 htdocs/
  | - css/
  | - js/
  | etc..

However I'm using it differently, here's my current file structure in the htdocs.

htdocs/
 | - project1/
 |    | - css/
 |    | - some other stuff for project1
 | - project2/
 |    | - css/
 |    | - some other stuff for project2
 | - vue-project/ (Where I wanted my Vue went to)
 |    | - css/
 |    | - stuff..

The error I get when I put dist/ of my vue project directly to htdocs/vue-project is 404, because they directly went back to the root file (root is htdocs/), in which it doesn't find the required file to launch Vue Project!

What I wanted

Anything that can launch the project in htdocs/vue-project/. Would accept any answer configuring either settings in the Vue/Webpack OR from XAMPP itself. If you need additional information please do ask in the comment section.

And if it turns out there are no other way, then I would accept answers involving XAMPP configuration on how to start a server in a different directories. Like start a server in htdocs, and other-file would be great as well.

Irfandy Jip
  • 1,308
  • 1
  • 18
  • 36

1 Answers1

2

For Vue CLI before 3.x

Try changing assetsPublicPath under build object in config/index.js. Then append your folder name there. Similiar issue that might help https://forum.vuejs.org/t/vue-js-webpack-deployment-for-xaamp-testing/28970

And if vue-router used then add ROUTER_BASE. https://router.vuejs.org/en/api/options.html#base

For Vue CLI 3

  1. Create vue.config.js inside your vue-projects
  2. Inside it simply add the following
module.exports = {
    publicPath: "/{path-to-your-vue-project}"
}

For more information please refer to this docs https://cli.vuejs.org/config/#publicpath

Irfandy Jip
  • 1,308
  • 1
  • 18
  • 36
Riddhi
  • 2,174
  • 1
  • 9
  • 17
  • Could you specify where the `config/index.js` is? I tried to look for `config` on my current Vue Project, but it's too many, could you specify it a little bit more? **P.S.** I think that was option for Vue CLI *before* 3, mine is Vue CLI 3. So I don't seem to find that directories.. – Irfandy Jip Feb 06 '19 at 08:04
  • 1
    Ok in vue cli3 it's not there.Have you gone through this ?https://cli.vuejs.org/config/#publicpath – Riddhi Feb 06 '19 at 08:12