In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-08 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
This article will explain in detail how to package and launch the vue project. The editor thinks it is very practical, so I share it for you as a reference. I hope you can get something after reading this article.
I. the transformation from development environment to production environment
After the project development is finished, we first need to notify the back end to get an online path, and then switch the previous development path to the online path.
Open the dev.env.js file in the config folder in the project and fill in the online path given by the back end.
'use strict'module.exports = {NODE_ENV:' "production", BASE_API:'"http://sdk.*********.cn:3838/"' / / online path} 2. Set a unified request path
After the hesitant project is packaged, all the js,css and images will be in their own unified folder, so the previous path needs to be changed, and a single modification takes too long, so what should be done?
Open the utils.js in the build folder and add it as needed, usually adding two.. /.
If (options.extract) {return ExtractTextPlugin.extract ({use: loaders, fallback: 'vue-style-loader', publicPath:'.. /.. / / newly added content, path configuration})} else {return ['vue-style-loader'] .concat (loaders)}}
In some cases, there will be the problem of incorrect introduction of the html primary path. At this time, we need to configure the index.js file inside the config folder and modify the assetsPublicPath. Note that the assetsPublicPath here is the assetsPublicPath path in the build production environment, not the assetsPublicPath in the dev development environment.
3. Run the packing command npm run build//. Generally speaking, it is build if you don't change it.
The result of running is as follows:
Generate a dist folder after running
This is the end of the article on "how to package and launch a vue project". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, please share it for more people to 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.