config/index.js About China bulid The default is assetsPublicPath yes ‘/’
See many people say to change to ‘./’, Otherwise, the packaged project will not be found js、css、 Pictures, these messages . The understanding of this part has always been vague , Record here .
assetsPublicPath Is it a relative path or an absolute path , It depends on how the front-end resources are released and deployed after you package it .
If say , You put index.html as well as static The folder goes directly to the root of the container , The access path is :http://xxxx:9090/index.html In this form , So use... Directly ‘/’ that will do , Don't use relative paths .
But if your front-end project is under a project folder or merged into a background project to publish , That is, the access path may be :http://xxx:9090/projectname/index.html, Then be sure to use './', Otherwise, the resource information will not be found .
in addition : Put it in static Picture below , When coding development, we can use relative path directly , and assetsPublicPath It doesn't matter if you configure it as a relative path or an absolute path . Don't confuse that .