react-tutorial icon indicating copy to clipboard operation
react-tutorial copied to clipboard

2.1 Webpack 配置 React 开发环境

Open theJian opened this issue 8 years ago • 4 comments

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 的错误.

theJian avatar Apr 21 '16 10:04 theJian

npm install babel-loader --save-dev 就可以了 babel-core在peerDependencies里

ofmiclee avatar Apr 21 '16 11:04 ofmiclee

当我只执行 npm install babel-loader --save-dev 时会报以下警告 npm WARN [email protected] requires a peer of babel-core@^6.0.0 but none was installed. @OfMicLee 你知道是什么原因吗

theJian avatar Apr 21 '16 15:04 theJian

@OfMicLee 啊, 我找到了, http://blog.npmjs.org/post/110924823920/npm-weekly-5 新的版本似乎不再自动安装 peerDependencies

theJian avatar Apr 21 '16 15:04 theJian

@theJian 是的 我的还是2.11.3老古董 会自动安装同伴依赖

ofmiclee avatar Apr 22 '16 02:04 ofmiclee