0
當我運行的WebPack一切編譯和捆綁,因爲它應該,但是當我運行的WebPack-dev的服務器我得到這個錯誤:的WebPack-dev的服務器配置錯誤,但作品的WebPack
Invalid configuration object. webpack-dev-server has been initialised using a configuration object that does not match the API schema.
- configuration has an unknown property 'error'. These properties are valid:
object { hot?, hotOnly?, lazy?, bonjour?, host?, allowedHosts?, filename?, publicPath?, port?, socket?, watchOptions?, headers?, clientLogLevel?, overlay?, progress?, key?, cert?, ca?, pfx?, pfxPassphrase?, requestCert?, inline?, disableHostCheck?, public?, https?, contentBase?, watchContentBase?, open?, useLocalIp?, openPage?, features?, compress?, proxy?, historyApiFallback?, staticOptions?, setup?, before?, after?, stats?, reporter?, noInfo?, quiet?, serverSideRender?, index?, log?, warn? }
我webpack.config .js文件的配置,看起來像這樣:
const path = require('path')
const webpack = require('webpack')
const HtmlWebpackPlugin = require('html-webpack-plugin')
const ExtractTextPlugin = require('extract-text-webpack-plugin')
const CopyWebpackPlugin = require('copy-webpack-plugin')
const CleanWebpackPlugin = require('clean-webpack-plugin')
module.exports = {
entry: {
bundle: path.resolve(__dirname, 'src/index.jsx'),
},
output: {
publicPath: '/',
path: __dirname + '/dist',
filename: '[name].[chunkhash].js',
},
devtool: 'source-map',
resolve: {
extensions: ['.js', '.jsx'],
},
externals: {
'react': 'React',
'react-dom': 'ReactDOM',
},
devServer: {
host: '0.0.0.0',
port: 8088,
historyApiFallback: true,
},
watchOptions: {
aggregateTimeout: 1,
ignored: /node_modules/,
},
module: {
loaders: [{
test: /.jsx?$/,
loader: 'babel-loader',
exclude: /node_modules/,
query: {
presets: ['es2015', 'react', 'stage-0'],
plugins: ['transform-runtime'],
},
}, {
test: /\.html$/,
loader: 'html-loader',
}, {
test: /\.less$/,
use: ExtractTextPlugin.extract({
fallback: 'style-loader',
use: 'css-loader!postcss-loader!less-loader',
}),
}, {
test: /\.(png|svg|jpg|ico)$/,
loader: 'file-loader?name=./img/[hash].[ext]',
}, {
test: /\.(ttf|woff|woff2|otf|eot)$/,
loader: 'file-loader?name=./fonts/[hash].[ext]',
}],
},
plugins: [
new CleanWebpackPlugin(['dist'], {
root: path.resolve(__dirname),
verbrose: true,
}),
new HtmlWebpackPlugin({
template: path.resolve(__dirname, 'src/index.html'),
}),
new ExtractTextPlugin({
filename: '[name].[chunkhash].css',
allChunks: false,
}),
new webpack.optimize.CommonsChunkPlugin({
name: 'commons',
}),
],
}
有在配置上沒有「錯誤」財產和的WebPack工作正常,它只是的WebPack-dev的服務器什麼是失敗?
有一個錯過了什麼?謝謝你的任何建議。