Vuejs in production: static path prefix
Context
I am creating a VueJS application and I would like to push it to production. I created the files using npm run build
and I uploaded them to the server (IIS).
I have many other applications on this server and I cannot change how it works.
Here's a fake example to help me explain my problem:
mydomain.com/app1
will be redirected to the web app under the folder app1
. To add my VueJS project, I created a new folder - let's say vueapp
- and I access it via mydomain.com/vueapp
.
The point is, the static paths generated by vue are not prefixed vueapp
. The paths in are index.html
not like what I want: I get mydomain.com/static/**
instead mydomaim.com/vueapp/static/**
for a vue request.
I'd like to tell webpack about the prefix index.html
, but I can't seem to get it to work.
assetsSubDirectory
config/build.js
gives us the ability to change the assets subdirectory (which is by default static
). So I can set it to vueappPrefix/static
, but of course it won't work.
- Expected:
mydomain.com/vueapp/vueappPrefix/static/*
- what i get:
mydomain.com/vueappPrefix/static
It is obvious.
Of course I can edit index.html
manually or add a script to do this, but I would like to know if there is a cleaner way to do this.
Many thanks.
source to share