In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-20 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article will explain in detail about nginx deployment vue project can not find js css file how to do, Xiaobian think quite practical, so share to everyone as a reference, I hope you can read this article after harvest.
Many times after npm run build, the relative directory of the js file css file automatically inserted by webpack in the index.html file is always wrong. After publishing to the server, nginx cannot find the file.
vue-cli@3
In vue-cli@3 you need to add a baseUrl for all files your webpack inserts into index.html. You need to create a new vue.config.js in the root directory of your project and add the following:
... module.exports = { baseUrl: isProd ? '/baseXXX/' : '/', ....}
Note that there is no need to add baseUrl in dev environment.
vue-cli@2
For projects that are not generated by vue-cli@3, if you don't care how webpack is implemented, you just need to find config/index.js and modify assetsPublicPath in build.
To verify this, you can build it locally and check if the path to the js css file referenced in dist/index.html carries the assetsPublicPath you just set.
For those of you who care why this is possible, continue to look at the build/webpack.base.conf.js file.
In non-production mode, it is set in config/index.js, where publicPath defaults to
About "nginx deployment vue project can not find js css file how to do" This article is shared here, I hope the above content can be of some help to everyone, so that you can learn more knowledge, if you think the article is good, please share it to let more people see.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.