My folder structure looks like this:
project
app
public
entry.coffee
build
webpack.config.js
dist
test
My webpack.config.js looks like this:
module.exports = {
cache: true,
context: path.resolve(__dirname + "/../app/public"),
entry: "./entry.coffee",
...
I’m receiving this error:
ERROR in Entry module not found: Error: Cannot resolve file or directory ./entry.coffee in /usr/local/webprojects/webpack/app/public
but the file ‘/usr/local/webprojects/webpack/app/public/entry.coffee’ does exist.
Run it with
--display-error-details
and it says why it cannot resolve it.No and probably never was. Close it.
This error may be caused by a syntax error in
package.json
.could also happen if you haven’t installed
babel-loader
I just ran into this using the CLI.
is valid, but
fails with this error. The solution is to specify the full relative path:
My json is fine linted ok.
I have the following structure
ROOT/src/entry.js
ROOT:webpack.config.js
module.exports = {
entry: ‘./src’,
output: {
path: ‘build’,
filename: ‘bundle.js’,
},
};
I tried ../src /src and src so I am a bit at a loss..anyone any ideas ? TY
[SOLVED FOR ME] I need to actually state the entry
entry: ‘./src/entry.js’,
I had to ensure that I displayed the full extension e.g. ‘./MyComponent.jsx’ instead of ‘./MyComponent’
@lancekuttner you could have used
resolve
inwebpack.config.js
to allow.jsx
extensions:For me this happened because in my
entry
object I wrote:While I should have written one of these:
The problem was that
path.resolve
will ignore any parameters given to it before the last parameter that starts with a/
.So
path.resolve(__dirname, '/test.js')
, will return/test.js
instead of/path/of/your/project/directory/test.js
.@towry is the best in the world forgot a comma in .json
This happened to me, and this issue was that had the following:
… instead of:
See if you can even find the difference (and once you do, see if it should even matter… relative paths should be considered to be rooted at whatever “./” is by whatever is interpreting the relative path…… no?)
What is the problem in this webpack entry?