react-tutorial
react-tutorial copied to clipboard
2.1 Webpack 配置 React 开发环境
Webpack 使用一个名为
webpack.config.js
的配置文件,要编译 JSX,先安装对应的 loader:npm install babel-loader --save-dev
在我的环境下是 npm install babel-loader babel-core --save-dev
, 不然执行 webpack -d --watch
会报找不到 babel-core 的错误.
npm install babel-loader --save-dev 就可以了 babel-core在peerDependencies里
当我只执行 npm install babel-loader --save-dev
时会报以下警告
npm WARN [email protected] requires a peer of babel-core@^6.0.0 but none was installed.
@OfMicLee 你知道是什么原因吗
@OfMicLee 啊, 我找到了, http://blog.npmjs.org/post/110924823920/npm-weekly-5 新的版本似乎不再自动安装 peerDependencies
@theJian 是的 我的还是2.11.3老古董 会自动安装同伴依赖