【问题标题】:React webpack bundling issue反应 webpack 捆绑问题
【发布时间】:2018-01-04 10:34:34
【问题描述】:

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

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

但是当我删除该组件的 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"
  }
}

【问题讨论】:

    标签: node.js reactjs webpack bundle


    【解决方案1】:

    删除你项目的node_modules并运行npm i

    【讨论】:

      猜你喜欢
      • 2017-08-04
      • 1970-01-01
      • 2018-06-16
      • 2017-01-15
      • 1970-01-01
      • 1970-01-01
      • 2017-07-28
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多