-
-
Notifications
You must be signed in to change notification settings - Fork 9.1k
Description
Do you want to request a feature or report a bug?
yes it is bug
What is the current behavior?
C:\Idessign>webpack
Hash: 18bc2fd105d4883da519
Version: webpack 4.2.0
Time: 108ms
Built at: 2018-3-24 18:56:38
WARNING in configuration
The 'mode' option has not been set. Set 'mode' option to 'development' or 'production' to enable defaults for this environment.
ERROR in Entry module not found: Error: Can't resolve './src' in 'C:\Idessign'
my webpack.config.js
const webpack = require('webpack'),
path = require('path'),
const APP_DIR = path.resolve(__dirname, "./src/");
const browserConfig ={
entry :
APP_DIR + 'client/index.js',
output : {
path : BUILD_DIR,
filename : "[name] bundle.js",
publicPath:BUILD_DIR,
},
}
always nothing
If the current behavior is a bug, please provide the steps to reproduce.
What is the expected behavior?
the compilation
If this is a feature request, what is motivation or use case for changing the behavior?
Please mention other relevant information such as the browser version, Node.js version, webpack version, and Operating System.
Version: webpack 4.2.0
windows 8.1profetionnel
Activity
matheus1lva commentedon Mar 24, 2018
Could you create a sample repository with a small example on how to reproduce this problem? Configuration seems fine. If you are having problems with configuration goes to stackoverflow and open a question there because this does not seems to be a problem with webpack.
montogeek commentedon Mar 25, 2018
src
folder exists? You are using wrong paths in your configuration.zycjiayou commentedon Mar 26, 2018
I have the same question, this is a bug.
Version: webpack 4.2.0
windows 8.1profetionnel
ooflorent commentedon Mar 26, 2018
It looks like some paths are misconfigured. I encourage you to ask your question on StackOverflow instead. We try to use the issue tracker for bug reports and feature requests, as well as some discussions, but this appears to be a very localized question.
I’m closing for these reasons.
peacecup commentedon Mar 28, 2018
I have the same problem.It hasn't solved the problem yet, do you have any idea?
ooflorent commentedon Mar 28, 2018
@peacecup please open a new issue with the reproduction code in a github repository
idessignflo commentedon Mar 28, 2018
the problem comes with webpack@4.3.0 the configuration it is correct
look my webpack.config.js
const webpack = require('webpack'),
path = require('path'),
ExtractTextPlugin = require("extract-text-webpack-plugin"),
nodeExternals = require('webpack-node-externals'),
srcPath = path.resolve(__dirname, "./src/"),
distPath = path.resolve(__dirname, './src/build/');
const HTMLPlugin = require('html-webpack-plugin');
const BUILD_DIR = path.resolve(__dirname , "./src/build/");
// var APP_DIR = path.resolve(__dirname, "src/app");
const APP_DIR = path.resolve(__dirname, "./src/");
const IMG_DIR = path.resolve(__dirname, './public/images');
const browserConfig = {
entry :
APP_DIR + 'client/index.js',
// APP_DIR + '/route/index.jsx',
resolve : {
alias:{
images : IMG_DIR
},
},
output : {
path : BUILD_DIR,
filename : "[name] bundle.js",
publicPath:BUILD_DIR,
},
};
but when i run webpack
C:\Idessign>webpack
Hash: 18bc2fd105d4883da519
Version: webpack 4.3.0
Time: 116ms
Built at: 2018-3-28 12:58:19
WARNING in configuration
The 'mode' option has not been set. Set 'mode' option to 'development' or 'production' to enable defaults for this environment.
ERROR in Entry module not found: Error: Can't resolve './src' in 'C:\Idessign'
C:\Idessign>
montogeek commentedon Mar 28, 2018
Yes, configuration is correct, but again, your paths are not:
const APP_DIR = path.resolve(__dirname, "./src/");
:src
folder doesn't exist.frankshin commentedon Apr 1, 2018
i have the same problem when use webpack4.2.0. is this problem solved?
frankshin commentedon Apr 3, 2018
it's caused by the error setting of 'script', you can inspect is it error
eg: 'webpack-dev-server --inline --progress --port 8001 --config webpack.dev.js'
matheus1lva commentedon Apr 3, 2018
@frankshin to help even more people here, if possible create a simple repository, where it is capable to reproduce your problem. This can help even more when they are making tests for it. Because this can be a configuration problem, rather than an error with webpack.
Inokinoki commentedon Apr 3, 2018
Excuse me.
The same problem occurred in my tiny project so I arrived at this page.
I tried to build a smallest project to reproduce it.
here
Thank you for glancing over it.
ooflorent commentedon Apr 3, 2018
@Inokinoki webpack searches for
src/index.js
. The file does not exist so it throws an error. Moreover,.jsx
are not handled without a loader.15 remaining items
scotmatson commentedon May 16, 2018
Just came across this error, while walking through this documentation, https://webpack.js.org/guides/getting-started/
In my case, was due to the working directory in relation to the npx command. I needed to be in the root of my project before running npx webpack.
paul-hammant commentedon May 20, 2018
^ Would be more clear.
yukha commentedon May 25, 2018
maybe you need to use backslash? '.\src\index.js'
zifn4b commentedon May 26, 2018
This particular issue I believe has to do with when webpack resorts to its default configuration on Windows it tries to resolve ./src and can't. It would need to resolve .\src instead. That's probably a bug.
iFlameing commentedon May 26, 2018
This particular issue is arise due to misconfigured path configuration. The folder in which webpack.config.js file exists does not contains the './src' folder so see the folder structure carefully to remove the bug.
domainoverflow commentedon May 27, 2018
if for some reason you used utf-8, i.e.: accented characters ( IDN, ex: é ) will also lead to this problem even though the underlying OS ( in this case centos 7 ) file system does not have a problem with it.
If the IDN character is a domain name, you can bypass this bug by converting it to punycode
(xn--...... . tld ).
One thing is for sure, user mishap or not, closing this issue every other week will not make it go away.
ddagsan commentedon May 28, 2018
try to go up folder, not src.
Shanuchauhan commentedon Jun 14, 2018
Hey,first you have to set the mode to development.
In the package.json file , you need to type this :
"scripts": {
"build": "webpack --mode production"
}
then the src problem is you have to create a src folder in which you have to create a index.js file.
then try running npm run build.
It works.
mqliutie commentedon Jun 19, 2018
mark
SirajKakeh commentedon Jul 4, 2018
I double @zifn4b and @domainoverflow, I spent hours on Windows trying to solve this but when tried the same project on Ubuntu 16.04 it worked like magic!
domainoverflow commentedon Jul 9, 2018
and yet @SirajKakeh the issue is closed every other week ..
SomeoneIsWorking commentedon Jul 13, 2018
Why is the issue closed?
ooflorent commentedon Jul 14, 2018
For everyone encountering this issue, it is most probably a configuration issue.
If you still think it is a bug, please open a new issue including an example to reproduce the error. Best put it in a GitHub repository.