node.js - Why exports readyPromise in dev-server.js in vuejs-templates/webpack?
仅有的幸福
仅有的幸福 2017-07-03 11:42:45
0
1
1057

Look at the source codedev-server.js is only called by node.js in package.json, as follows:

    "start": "node build/dev-server.js",

But are the exports in dev-server.js returned to node.js? How will node.js use the returned readyPromise?

The address of

vuejs-templates/webpack is:
https://github.com/vuejs-temp...

仅有的幸福
仅有的幸福

reply all(1)
滿天的星座

The purpose of exporting readyPromise here is to provide a hook for users to perform customized operations after webpack packaging is completed. You can introduce the export of dev-server.js in a script,

//custom.js
let devServer = require('dev-server.js')
devServer.then(()=>{
    //执行自定义的操作
})

Replace the original start task content in packge.json with "node build/dev-server.js", so that npm run start will perform customized operations

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template