I'm building a VueJS app and I would like to push it in production. I've generated files using npm run build
and I've uploaded those on a server (IIS).
I have a lot of other applications on this server and I can't change how it works.
Here is a fake example to help me explain my issue:
mydomain.com/app1
will redirect to a web-app under a folder app1
.
To add my VueJS project I've created a new folder - lets say vueapp
- and I get access it via mydomain.com/vueapp
.
The thing is : the static paths generated by vue are not prefixed by vueapp
. Paths in index.html
are not like I want : I get mydomain.com/static/**
instead of mydomaim.com/vueapp/static/**
for a vue request.
I would like to tell webpack to prefix index.html
's path by something but I can't get it work.
config/build.js
gives us the possibility to change the assets sub directory (which is static
by default). So I can set it to vueappPrefix/static
but of course, this doesn't work.
mydomain.com/vueapp/vueappPrefix/static/*
mydomain.com/vueappPrefix/static
This is obvious.
Of course I can edit index.html
by hand or add a script to do it but I would like to know if there is a cleaner way to do this.
Thanks a lot.
Changing the assetsPublicPath
works for me.
In this case, it'd be:
assetsPublicPath: '/vueapp/'
UPDATE (11/20): To do the same in newer versions of vue-cli
, there's an option mentioned in the comments.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With