我一直在使用带有它和标志的webpack-dev-server 。这一切都很好。--inline
--host
webpack-dev-server --inline --host example.com
然后我研究了使用gulp和 webpack-dev-server API来完成这个任务。
var gulp = require('gulp');
var gutil = require('gulp-util');
var Webpack = require('webpack');
var WebpackDevServer = require('webpack-dev-server');
var WebpackConfig = require('./webpack.config.js');
gulp.task('default', ['webpack-dev-server']);
gulp.task('webpack-dev-server', function(callback) {
new WebpackDevServer(Webpack(WebpackConfig), {
host: 'example.com',
inline: true,
publicPath: WebpackConfig.output.publicPath,
}).listen(port, host, function(err) {
if(err) throw new gutil.PluginError('webpack-dev-server', err);
gutil.log('[webpack-dev-server]', 'http://example.com:8080');
});
});
这似乎不起作用,我相信没有inline
或host
用于API。
知道这是否可能吗?