TypeError: chunk.hasRuntime is not a function
node版本: v7.7.1
npm版本:4.2.0
webpack配置如下:
const pkg = require('../package.json');
const path = require('path');
const webpack = require('webpack');
module.exports = {
target: 'web',
context: path.resolve(__dirname, '../'),
devtool: 'cheap-module-eval-source-map',
entry: {
client: [
'webpack-hot-middleware/client',
'./src/index.js',
],
},
output: {
path: path.join(__dirname, '../build'),
publicPath: '/build/',
filename: '[name].js',
chunkFilename: '[name].chunk.js',
},
resolve: {
extensions: ['.js', '.css', '.json'],
modules: ['node_modules'],
},
module: {
rules: [{
test: /\.js$/,
loader: 'babel-loader',
include: path.resolve(__dirname, '../src'),
options: {
cacheDirectory: true,
babelrc: false,
presets: [
['env', {
targets: {
browsers: pkg.browserslist,
},
modules: false,
useBuiltIns: false,
debug: false,
}],
'stage-2', 'react',
],
},
}, {
test: /\.css$/,
include: [
path.join(__dirname, '../src'),
],
use: [
{
loader: 'style-loader',
},
{
loader: 'css-loader',
},
{
loader: 'postcss-loader',
options: {
config: './tools/postcss.config.js',
},
},
],
}, {
test: /\.(ico|jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2)(\?.*)?$/,
loader: 'file-loader',
query: {
name: '[path][name].[ext]?[hash:8]',
},
}],
},
plugins: [
new webpack.optimize.CommonsChunkPlugin({
name: 'vendor',
minChunks: module => /node_modules/.test(module.resource),
}),
new webpack.optimize.CommonsChunkPlugin({
name: 'manifest',
minChunks: Infinity,
}),
new webpack.HotModuleReplacementPlugin(),
new webpack.NoEmitOnErrorsPlugin(),
new webpack.DefinePlugin({
'process.env.NODE_ENV': JSON.stringify('development'),
'process.env.BROWSER': true,
__DEV__: true,
}),
],
};
执行命令 webpack -p
报下面的错误
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论