Fixed the problem that the URLs of fonts and images in the CSS files are incorrect when assetsPublicPath set to ./ in production environment.
Now the 'dist' directory can be visited by any URL root path at the same time.
For example:
visit http://192.168.1.101/project/ in intranet,
and visit http://project.example.com/ in internet.
Fixed the problem that the URLs of fonts and images in the CSS files are incorrect when
assetsPublicPath
set to./
in production environment. Now the 'dist' directory can be visited by any URL root path at the same time. For example: visithttp://192.168.1.101/project/
in intranet, and visithttp://project.example.com/
in internet.修正
assetsPublicPath
被设置成./
时,CSS文件中的图片、字体等引用地址错误的问题。 现在项目可以支持发布到任意层级的目录。比如在维护主机的内网环境下使用http://192.168.1.101/project/
访问主页,同时又可以在广域网下以http://project.example.com/
这样的根路径访问同一主机。 如果项目地址发生变动,比如从http://www.example.com/project-a/
变成了http://www.example.com/project-b/sub-a/
,也仅仅只需要调整项目文件目录,而不需要修改assetsPublicPath
并重新编译打包。