【发布时间】: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