-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdevelop.js
34 lines (29 loc) · 876 Bytes
/
develop.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
const port = 8080,
path = require('path'),
app = new (require('koa'))(),
chalk = require('chalk'),
webpack = require('webpack'),
baseConfig = require('../example/webpack.config'),
FriendlyErrorsPlugin = require('friendly-errors-webpack-plugin');
console.log(chalk.yellow('> Start Compile:\n'));
baseConfig.plugins.push(
new FriendlyErrorsPlugin()
);
app.use(require('koa-static')(path.join(__dirname, '../example')));
app.listen(port);
const compiler = webpack(baseConfig);
compiler.watch(
{
ignored: /node_modules/,
},
(err) => {
if (err) {
console.error(err.stack || err);
if (err.details) {
console.error(err.details);
}
return;
}
console.log(chalk.yellow(`Your application is already set at http://localhost:${port}/.`));
}
);