Vuepress construction details

Preface:

Last time we talked about the vuepress build process, here we will continue to talk about the vuepress package after the operation

1. In.vuepressnewapp.js

/.vuepress/app.js

/* * @Author: wgj * @Date: 2021-04-26 17:43:01 * @LastEditTime: 2021-04-26 17:53:53 * @LastEditors: wgj * @Description: * /
const Koa = require('koa');
const app = new Koa();
const staticFiles = require('koa-static');
app.use(staticFiles(__dirname + '/dist')); // Static directory


// Listen on the port and start the program
app.listen(3001.err= > {
    if (err) throw err;
    console.log('runing... ');
})
Copy the code

2. Run commands

Initialize package.json
npm init

Install statically recognized static directory packages
npm install koa-static --save-dev

# start service
node app

# visit http://localhost:3001
Copy the code