反应webpack捆绑问题

时间:2018-01-04 10:34:35

标签: node.js reactjs webpack bundle

我为react组件创建了一个webpack bundle.js

当我将 node_modules 文件夹导入另一个反应项目时,它工作正常。

但是当我删除该组件的 node_modules 文件夹时,我的新反应应用程序无效。

这是错误: -

Module build failed: ReferenceError: Unknown plugin "transform-object-rest-spread" specified in .....

以下是我的 package.json

{
  "name": "react-component",
  "version": "0.0.1",
  "description": "Put a description here",
  "main": "build/index.js",
  "dependencies": {
    "react": "^15.5.4",
    "webpack": "^2.6.1",
    "babel-cli": "^6.24.1",
    "babel-core": "^6.24.1",
    "babel-loader": "^7.0.0",
    "babel-plugin-transform-object-rest-spread": "^6.23.0",
    "babel-plugin-transform-react-jsx": "^6.24.1",
    "babel-preset-env": "^1.5.1"
  },
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1",
    "start": "webpack --watch",
    "build": "webpack"
  },
  "author": {
    "name": "Your name",
    "email": "your email"
  }
}

1 个答案:

答案 0 :(得分:0)

删除项目的node_modules并运行npm i

相关问题