...
|
...
|
@@ -18,6 +18,8 @@ const webpack = require('webpack'); |
|
|
const WebpackDevServer = require('webpack-dev-server');
|
|
|
const webpackConfig = require('./webpack.config.js');
|
|
|
const ExtractTextPlugin = require('extract-text-webpack-plugin');
|
|
|
const Dashboard = require('webpack-dashboard');
|
|
|
const DashboardPlugin = require('webpack-dashboard/plugin');
|
|
|
|
|
|
const env = {
|
|
|
dev: Symbol('development'),
|
...
|
...
|
@@ -184,6 +186,7 @@ gulp.task('postcss', ['assets'], () => { |
|
|
|
|
|
// webpack dev server
|
|
|
gulp.task('webpack-dev-server', () => {
|
|
|
const useDashboard = process.platform === 'darwin' || process.platform === 'linux';
|
|
|
const devConfig = Object.assign({}, webpackConfig, {
|
|
|
devtool: '#inline-source-map',
|
|
|
vue: {
|
...
|
...
|
@@ -200,10 +203,25 @@ gulp.task('webpack-dev-server', () => { |
|
|
}
|
|
|
});
|
|
|
|
|
|
devConfig.output.publicPath = 'http://localhost:5004/';
|
|
|
|
|
|
// 开发环境插件
|
|
|
devConfig.plugins.push(new webpack.HotModuleReplacementPlugin());
|
|
|
|
|
|
if (useDashboard) {
|
|
|
const dashboard = new Dashboard(); // webpackDashboardPlugin
|
|
|
|
|
|
devConfig.plugins.push(new DashboardPlugin(dashboard.setData));
|
|
|
}
|
|
|
|
|
|
devConfig.entry.libs.unshift(`webpack-dev-server/client?${devConfig.output.publicPath}`, 'webpack/hot/dev-server');
|
|
|
|
|
|
new WebpackDevServer(webpack(devConfig), {
|
|
|
contentBase: '.',
|
|
|
publicPath: '//localhost:5004/',
|
|
|
publicPath: devConfig.output.publicPath,
|
|
|
hot: true,
|
|
|
inline: true,
|
|
|
quiet: useDashboard,
|
|
|
stats: {
|
|
|
colors: true
|
|
|
},
|
...
|
...
|
@@ -214,7 +232,7 @@ gulp.task('webpack-dev-server', () => { |
|
|
if (err) {
|
|
|
throw new gutil.PluginError('webpack-dev-server', err);
|
|
|
}
|
|
|
gutil.log('[webpack-serve]', 'http://localhost:5004/');
|
|
|
gutil.log('[webpack-serve]', devConfig.output.publicPath);
|
|
|
});
|
|
|
});
|
|
|
|
...
|
...
|
|