After VUE completes the project, the method of packing into a static file

After VUE completes the project, how to pack it into a static file, and use Node debug

1. Modify the productionsource in the index.js inside the config to False, the default is true (TRUE represents the package environment is the development environment, you can debug; false representation of the production environment, officially launched)

2. Run NPM Run Build in the cmd, (running in build in Build Build.js file)

The generated package is placed under the Dist

vue完成项目后,打包成静态文件的方法 Using Node for debugging

1, create a prod.server.js file in the root directory, the role of this file is as a small httpserver, under normal development, you can put the files in the Dist in Tomcat to debug

/ ** * Created by Administrator on 2017/22. * / Var express = Require (‘express’) var config = Require (‘./ config / index’) var port = process.env.port || config.build.port var app = expression () var Router = Express.Router () Router .get (‘/’, function (req, res, next) {req.url = ‘/index.html’ next ()}) app.use (routER // Asynchronous interface
   VAR SELLER = Require ('./ src / data / data.json') var Apiroutes = Express.Router () APIROUTES.GET ('/ Seller', Function (Req, Res) {Res. Json ({DATA: SELLER})} 
   App.use ('/ API', APIROUTES); // Defines Express Static Directory App.USE (Express.Static ('./ dist')) VAR AutoOpenBrowser = !! config.dev.autoopenBrowser VAR URI = 'http: // localhost:' + port var opn = Require ('OPN') // Start express module.exports = app.listen (port, function (err) {if (err) {console.log Err) RETURN} // when env is testing, don't Need Open IT IF (AutoOpenBrowser && Process.env.node_env! == 'Testing') {OPN (URI)}} 
After the VUE is completed, the method of packing into a static document is that Xiaobian sharing all the contents, I hope I can give you a reference, I hope everyone will support Tumi Cloud.
                     
© Copyright Notice
THE END
Just support it if you like
like0
share
comment Grab the couch

Please log in to comment