如何解决“ TypeError:无法读取JavaScript的null属性”绑定”?

时间:2019-07-04 18:01:49

标签: javascript webpack babel

我正在使用Javascript开发Web应用程序,并且希望将其与Webpack捆绑在一起,但出现此错误:

TypeError: Cannot read property 'bindings' of null

我该如何解决这个问题?

ERROR in ./src/js/views/searchview.js
Module build failed (from ./node_modules/babel-loader/lib/index.js):
TypeError: Cannot read property 'bindings' of null
    at Scope.moveBindingTo (D:\dev\JavaScript Files\node_modules\@babel\traverse\lib\scope\index.js:864:13)
    at convertBlockScopedToVar (D:\dev\JavaScript Files\forkify\node_modules\babel-plugin-transform-es2015-block-scoping\lib\index.js:139:13)
    at PluginPass.VariableDeclaration (D:\dev\JavaScript Files\forkify\node_modules\babel-plugin-transform-es2015-block-scoping\lib\index.js:26:9)

package.json:

{
  "name": "somthing",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "dev": "webpack --mode development",
    "build": "webpack --mode production",
    "start": "webpack-dev-server --mode development --open"
  },
  "author": "somthing",
  "license": "ISC",
  "devDependencies": {
    "babel-core": "^6.26.3",
    "babel-loader": "^8.0.6",
    "babel-preset-env": "^1.7.0",
    "html-webpack-plugin": "^3.2.0",
    "webpack": "^4.35.0",
    "webpack-cli": "^3.3.5",
    "webpack-dev-server": "^3.7.2"
  },

  "dependencies": {
    "@babel/core": "^7.4.5",
    "babel-polyfill": "^6.26.0"
  }
}

babelrc:

{
    "presets":[
        ["env", {
            "targets":{
                "browser":[
                    "last 5 versions",
                    "ie >= 8"
                ]
            }
        }]
    ]
}

0 个答案:

没有答案