码迷,mamicode.com
首页 > 其他好文 > 详细

vue : 自定义脚手架提示

时间:2018-06-19 22:38:41      阅读:168      评论:0      收藏:0      [点我收藏+]

标签:图片   image   reject   plugin   sage   ISE   color   utils   error   

做项目做烦了就想找点乐子。

比如,我们可以自定义脚手架提示。

 webpack.dev.conf.js 

54-78 行 

module.exports = new Promise((resolve, reject) => {
  portfinder.basePort = process.env.PORT || config.dev.port
  portfinder.getPort((err, port) => {
    if (err) {
      reject(err)
    } else {
      // publish the new Port, necessary for e2e tests
      process.env.PORT = port
      // add port to devServer config
      devWebpackConfig.devServer.port = port

      // Add FriendlyErrorsPlugin
      devWebpackConfig.plugins.push(new FriendlyErrorsPlugin({
        compilationSuccessInfo: {
          messages: [`万物皆虚,万事皆允。 \nYour application is running here: http://${config.dev.host}:${port}`],
        },
        onErrors: config.dev.notifyOnErrors
        ? utils.createNotifierCallback()
        : undefined
      }))

      resolve(devWebpackConfig)
    }
  })
})

 最后效果是这样的:

 技术分享图片

 

vue : 自定义脚手架提示

标签:图片   image   reject   plugin   sage   ISE   color   utils   error   

原文地址:https://www.cnblogs.com/foxcharon/p/9201237.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!