2017-06-25 13:13:39 -05:00
|
|
|
import webpack from 'webpack';
|
|
|
|
import WebpackDevServer from 'webpack-dev-server';
|
|
|
|
import config from './webpack.dev.config.babel';
|
|
|
|
import ora from 'ora';
|
2017-07-15 14:58:05 -05:00
|
|
|
import env from '../src/config/env';
|
2017-06-25 13:13:39 -05:00
|
|
|
|
|
|
|
const compiler = webpack(config);
|
|
|
|
const spinner = ora('Compiler is running...').start();
|
2018-04-26 22:52:24 -05:00
|
|
|
compiler.hooks.done.tap('Verdaccio Dev Server', () => {
|
2017-06-25 13:13:39 -05:00
|
|
|
if (!global.rebuild) {
|
|
|
|
spinner.stop();
|
2017-07-13 16:28:45 -05:00
|
|
|
console.log('Dev Server Listening at http://localhost:4872/');
|
|
|
|
global.rebuild = true;
|
2017-06-25 13:13:39 -05:00
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
new WebpackDevServer(compiler, {
|
|
|
|
contentBase: `${env.DIST_PATH}`,
|
|
|
|
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,
|
2017-07-15 15:04:58 -05:00
|
|
|
chunkModules: false,
|
|
|
|
},
|
2018-07-21 13:49:10 -05:00
|
|
|
proxy: [{
|
|
|
|
context: ['/-/verdaccio/logo', '/-/verdaccio/packages', '/-/static/logo.png'],
|
|
|
|
target: 'http://localhost:4873',
|
|
|
|
}],
|
2017-07-13 16:28:45 -05:00
|
|
|
}).listen(4872, 'localhost', function(err) {
|
2017-06-25 13:13:39 -05:00
|
|
|
if (err) {
|
|
|
|
return console.log(err);
|
|
|
|
}
|
2017-07-13 16:28:45 -05:00
|
|
|
});
|