Webpack: Assets Public Path for build is set to '/', why not './' ?

Created on 2 Aug 2017  路  2Comments  路  Source: vuejs-templates/webpack

Hi,

In the configuration, the AssetPublicPath for the build is set to '/'.

I got a directory on a IIS server where I publish all my app in subfolders.
Because of the '/' configuration, when I build and copy it in a subfolder all assets are not found.

For example, i put my built result in http://myserv/projects/myapp/static/js/manifest.add4406db34decf2ea44.js
And my website is at
http://myserv/projects
All links like
/static/js/manifest.add4406db34decf2ea44.js
Will be search in
http://myserv/projects/static/js/manifest.add4406db34decf2ea44.js
Instead of
http://myserv/projects/myapp/static/js/manifest.add4406db34decf2ea44.js

So i wonder why the AssetPublicPath is not set to './' for the build config, is there a reason ?

Most helpful comment

Relative assets folders don't work well with vue-router in history mode. Particularly, asserts can't be resolved when doing page refreshs for any path but the root.

But yes, it's not well suite for dynamic deployment scenarios in subfolders, so we gave you an easy way to change it in the config folder :)

All 2 comments

You're right, './' works for the case.

A long time ago (before Vue 2.x or so) I had a short chat with Evan about this. But I can't remember why I didn't make a PR. Maybe you could do it.

Relative assets folders don't work well with vue-router in history mode. Particularly, asserts can't be resolved when doing page refreshs for any path but the root.

But yes, it's not well suite for dynamic deployment scenarios in subfolders, so we gave you an easy way to change it in the config folder :)

Was this page helpful?
0 / 5 - 0 ratings