2019-04-05 02:23:40 +07:00
|
|
|
import webpack from 'webpack';
|
|
|
|
import WebpackDevServer from 'webpack-dev-server';
|
|
|
|
import config from './webpack.dev.config.babel';
|
|
|
|
import ora from 'ora';
|
2019-06-20 19:37:28 +07:00
|
|
|
import env from '../config/env';
|
2019-02-03 17:23:33 +07:00
|
|
|
|
|
|
|
const compiler = webpack(config);
|
2019-04-05 02:23:40 +07:00
|
|
|
const spinner = ora('Compiler is running...').start();
|
|
|
|
compiler.hooks.done.tap('Verdaccio Dev Server', () => {
|
2019-02-03 17:23:33 +07:00
|
|
|
if (!global.rebuild) {
|
|
|
|
spinner.stop();
|
2019-04-05 02:23:40 +07:00
|
|
|
console.log('Dev Server Listening at http://localhost:4872/');
|
2019-02-03 17:23:33 +07:00
|
|
|
global.rebuild = true;
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
new WebpackDevServer(compiler, {
|
2019-04-05 02:23:40 +07:00
|
|
|
contentBase: `${env.DIST_PATH}`,
|
2019-02-03 17:23:33 +07:00
|
|
|
publicPath: config.output.publicPath,
|
|
|
|
hot: true,
|
|
|
|
historyApiFallback: true,
|
|
|
|
quiet: true,
|
|
|
|
noInfo: false,
|
|
|
|
stats: {
|
|
|
|
assets: false,
|
|
|
|
colors: true,
|
|
|
|
version: true,
|
|
|
|
hash: true,
|
|
|
|
timings: true,
|
|
|
|
chunks: true,
|
2019-04-05 02:23:40 +07:00
|
|
|
chunkModules: false,
|
2019-02-03 17:23:33 +07:00
|
|
|
},
|
2019-06-20 19:37:28 +07:00
|
|
|
proxy: [
|
|
|
|
{
|
2019-07-28 16:49:02 +07:00
|
|
|
context: ['/-/verdaccio/**', '**/*.tgz'],
|
2019-04-06 22:42:52 +07:00
|
|
|
target: 'http://localhost:8080',
|
2019-06-20 19:37:28 +07:00
|
|
|
},
|
|
|
|
],
|
2019-04-05 02:23:40 +07:00
|
|
|
}).listen(4872, 'localhost', function(err) {
|
2019-02-03 17:23:33 +07:00
|
|
|
if (err) {
|
|
|
|
return console.log(err);
|
|
|
|
}
|
|
|
|
});
|