2017-07-04 03:28:56 +00:00
|
|
|
'use strict';
|
|
|
|
const chalk = require('chalk');
|
2017-04-12 04:59:58 +00:00
|
|
|
|
|
|
|
// this plugin if for loggin url after each time the compilation is done.
|
|
|
|
module.exports = class LogPlugin {
|
|
|
|
constructor(port) {
|
2017-07-04 03:28:56 +00:00
|
|
|
this.port = port;
|
2017-04-12 04:59:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
apply(compiler) {
|
2017-09-20 00:47:46 +00:00
|
|
|
const protocol = process.env.HTTPS ? 'https' : 'http';
|
2017-04-12 04:59:58 +00:00
|
|
|
compiler.plugin('done', () => {
|
2017-07-04 03:28:56 +00:00
|
|
|
console.log(
|
2017-09-20 00:47:46 +00:00
|
|
|
`> App is running at ${chalk.yellow(
|
|
|
|
`${protocol}://localhost:${this.port}`
|
|
|
|
)}\n`
|
2017-07-04 03:28:56 +00:00
|
|
|
);
|
|
|
|
});
|
2017-04-12 04:59:58 +00:00
|
|
|
}
|
2017-07-04 03:28:56 +00:00
|
|
|
};
|