2017-07-04 03:28:56 +00:00
|
|
|
'use strict';
|
|
|
|
const chalk = require('chalk');
|
2017-04-12 04:59:58 +00:00
|
|
|
|
2018-04-05 20:53:36 +00:00
|
|
|
const LogPlugin = function(port) {
|
|
|
|
this.port = port;
|
|
|
|
this.protocol = process.env.HTTPS ? 'https' : 'http';
|
|
|
|
};
|
2017-04-12 04:59:58 +00:00
|
|
|
|
2018-04-05 20:53:36 +00:00
|
|
|
LogPlugin.prototype.apply = function(compiler) {
|
|
|
|
compiler.plugin('done', (compiler, done) => {
|
|
|
|
console.log(
|
|
|
|
`> App is running at ${chalk.yellow(
|
|
|
|
`${this.protocol}://localhost:${this.port}`
|
|
|
|
)}\n`
|
|
|
|
);
|
|
|
|
});
|
2017-07-04 03:28:56 +00:00
|
|
|
};
|
2018-04-05 20:53:36 +00:00
|
|
|
|
|
|
|
module.exports = LogPlugin;
|