search

Home  >  Q&A  >  body text

node.js - Why exports readyPromise in dev-server.js in vuejs-templates/webpack?

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...

仅有的幸福仅有的幸福2707 days ago1026

reply all(1)I'll reply

  • 滿天的星座

    滿天的星座2017-07-03 11:44:45

    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

    reply
    0
  • Cancelreply