清除node_modules
文件夾並執行乾淨npm build
並運行webpack後,遇到以下錯誤。清理node_modules文件夾後webpack babel生成錯誤
有人可以幫助我瞭解我得到的錯誤嗎?即時通訊新的webpack。
下面的代碼片段是我的webpack.config
var path = require('path');
var webpack = require('webpack');
var config = {
devtool: 'cheap-module-eval-source-map',
entry: [
'webpack-hot-middleware/client',
'./app/main'
],
output: {
path: path.join(__dirname, 'public', 'js'),
filename: 'bundle.js',
publicPath: '/js'
},
plugins: [
new webpack.HotModuleReplacementPlugin(),
new webpack.NoErrorsPlugin(),
new webpack.optimize.OccurenceOrderPlugin(),
new webpack.DefinePlugin({
'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV)
})
],
module: {
loaders: [
{
test: /\.js$/,
exclude: /node_modules/,
loader: 'babel',
query: {
plugins: [
['react-transform', {
transforms: [
{
transform: 'react-transform-hmr',
imports: ['react'],
locals: ['module']
}, {
transform: 'react-transform-catch-errors',
imports: ['react', 'redbox-react']
}
]
}]
],
presets: ['react', 'es2015', 'stage-1']
}
}
]
},
resolve: {
extensions: ['', '.js', '.jsx', 'css', 'scss']
},
};
ERROR in ./app/components/App.js Module build failed: TypeError: /Users/ericlin/projects/360/app/components/App.js: Property id of VariableDeclarator expected node to be of a type ["LVal"] but instead got "CallExpression" at Object.validate (/Users/ericlin/projects/360/node_modules/babel-types/lib/definitions/index.js:109:13) at Object.validate (/Users/ericlin/projects/360/node_modules/babel-types/lib/index.js:541:9) at NodePath._replaceWith (/Users/ericlin/projects/360/node_modules/babel-traverse/lib/path/replacement.js:208:7) at NodePath.replaceWith (/Users/ericlin/projects/360/node_modules/babel-traverse/lib/path/replacement.js:186:8) at RewireState.Identifier (/Users/ericlin/projects/360/node_modules/babel-plugin-rewire/lib/babel-plugin-rewire.js:176:10) at NodePath._call (/Users/ericlin/projects/360/node_modules/babel-traverse/lib/path/context.js:76:18) at NodePath.call (/Users/ericlin/projects/360/node_modules/babel-traverse/lib/path/context.js:48:17) at NodePath.visit (/Users/ericlin/projects/360/node_modules/babel-traverse/lib/path/context.js:106:12) at TraversalContext.visitQueue (/Users/ericlin/projects/360/node_modules/babel-traverse/lib/context.js:167:16) at TraversalContext.visitSingle (/Users/ericlin/projects/360/node_modules/babel-traverse/lib/context.js:118:19) at TraversalContext.visit (/Users/ericlin/projects/360/node_modules/babel-traverse/lib/context.js:211:19) at Function.traverse.node (/Users/ericlin/projects/360/node_modules/babel-traverse/lib/index.js:161:17) at NodePath.visit (/Users/ericlin/projects/360/node_modules/babel-traverse/lib/path/context.js:116:19) at TraversalContext.visitQueue (/Users/ericlin/projects/360/node_modules/babel-traverse/lib/context.js:167:16) at TraversalContext.visitMultiple (/Users/ericlin/projects/360/node_modules/babel-traverse/lib/context.js:113:17) at TraversalContext.visit (/Users/ericlin/projects/360/node_modules/babel-traverse/lib/context.js:209:19) at Function.traverse.node (/Users/ericlin/projects/360/node_modules/babel-traverse/lib/index.js:161:17) at NodePath.visit (/Users/ericlin/projects/360/node_modules/babel-traverse/lib/path/context.js:116:19) at TraversalContext.visitQueue (/Users/ericlin/projects/360/node_modules/babel-traverse/lib/context.js:167:16) at TraversalContext.visitMultiple (/Users/ericlin/projects/360/node_modules/babel-traverse/lib/context.js:113:17) at TraversalContext.visit (/Users/ericlin/projects/360/node_modules/babel-traverse/lib/context.js:209:19) at Function.traverse.node (/Users/ericlin/projects/360/node_modules/babel-traverse/lib/index.js:161:17) at traverse (/Users/ericlin/projects/360/node_modules/babel-traverse/lib/index.js:83:12) at NodePath.traverse (/Users/ericlin/projects/360/node_modules/babel-traverse/lib/path/index.js:147:25) at PluginPass.exit (/Users/ericlin/projects/360/node_modules/babel-plugin-rewire/lib/babel-plugin-rewire.js:199:11) at newFn (/Users/ericlin/projects/360/node_modules/babel-traverse/lib/visitors.js:301:19) at NodePath._call (/Users/ericlin/projects/360/node_modules/babel-traverse/lib/path/context.js:76:18) at NodePath.call (/Users/ericlin/projects/360/node_modules/babel-traverse/lib/path/context.js:48:17) at NodePath.visit (/Users/ericlin/projects/360/node_modules/babel-traverse/lib/path/context.js:118:8) at TraversalContext.visitQueue (/Users/ericlin/projects/360/node_modules/babel-traverse/lib/context.js:167:16) @ ./app/routes.js 31:11-38
回滾到巴別塔 - 插件,重新連接感謝1.0.0-RC-4爲我工作! – Pakage