采纳答案成功!
向帮助你的同学说点啥吧!感谢那些助人为乐的人
老师,在生成bundle.js过程中,控制台输入webpack,但是却显示ERROR in Entry module not found: Error: Can't resolve './js/index.js' in 'D:\mukewangzuoye\react_ex\05-01/src'错误,这是怎么回事呢?
同学你好,我也遇到了这个问题,请问你是如何解决的ERROR in Entry module not found: Error: Can't resolve './src/js/index.js' in 'D:\reactD\mk\05-01-4/src'
index.js 中的代码是?路径对吗?
index.js中的代码: var React = require('react'); var ReactDOM = require('react-dom'); ReactDOM.render( <h1>Hello world</h1>, document.getElementById('example') ); webpack.config.js内容: var webpack = require('webpack'); var path = require('path'); module.exports = { context: __dirname+'/src', entry: "./src/js/index.js", module: { loaders: [ { test: /\.js?$/, exclude: /(node_modules)/, loader: 'babel-loader', query: { presets: ['react', 'es2015'] } } ] }, output: { path: __dirname+"/src/", filename: "bundle.js" } }; 感觉没有问题啊!! 我对比从慕课上下载的代码发现那里面的代码和课程里面讲解的代码不一样-webpack.config.js,我是按照视频讲解的那样写的
同学你好,下载我的源码可以运行吗?
不可以,有报错,我的操作步骤如下: (1)D:\reactD\mk\IMOOC-React-master\05-02>cnpm install (2)D:\reactD\mk\IMOOC-React-master\05-02>webpack Hash: 0883de5a5a2153383c68 Version: webpack 1.15.0 Time: 31ms ERROR in Entry module not found: Error: Cannot resolve module 'babel-loader' in D:\reactD\mk\IMOOC-React-master\05-02 (3)D:\reactD\mk\IMOOC-React-master\05-02>cnpm install --save babel-loader √ Installed 1 packages √ Linked 0 latest versions √ Run 0 scripts √ All packages installed (used 719ms, speed 52.43kB/s, json 1(37.7kB), tarball 0B) (4)D:\reactD\mk\IMOOC-React-master\05-02>webpack Hash: 0883de5a5a2153383c68 Version: webpack 1.15.0 Time: 617ms + 1 hidden modules ERROR in ./src/js/index.js Module build failed: TypeError: fileSystem.statSync is not a function at module.exports (D:\reactD\mk\IMOOC-React-master\05-02\node_modules\_babel-loader@7.1.3@babel-loader\lib\utils\exists.js:7:25) at find (D:\reactD\mk\IMOOC-React-master\05-02\node_modules\_babel-loader@7.1.3@babel-loader\lib\resolve-rc.js:13:9) at Object.module.exports (D:\reactD\mk\IMOOC-React-master\05-02\node_modules\_babel-loader@7.1.3@babel-loader\lib\index.js:113:132)
登录后可查看更多问答,登录/注册
轻松入门 React 开发,React Router 4 与 Webpack 2 完美升级项目
5.4k 6
5.2k 6
2.5k 18
2.6k 14
2.9k 13