0

I'm getting a strange error with webpack 3.8.1 when I build:

ERROR in multi ./src ./build/
Module not found: Error: Can't resolve '/Users/me/files/project/build/' in '/Users/me/files/project'
 @ multi ./src ./build/

And if I upgrade to webpack 3.11.0:

ERROR in Entry module not found: Error: Can't resolve '/Users/me/files/project/build/' in '/Users/me/files/project'

My project seems to be getting built, but it keeps logging this error. Everything works fine with the devserver. None of the solutions in https://github.com/webpack/webpack/issues/981 or Webpack Error - Cannot Resolve File or Directory are helping.

natevw
  • 16,807
  • 8
  • 66
  • 90

1 Answers1

0

The issue was my own fault. I was trying to build my app using the webpack build "command", which is not a command at all! Instead webpack thought I was trying to build something called "build".

The correct usage to get webpack to build is simply

webpack

with no subcommands or additional paths.

Via a sample project I did have an npm build script set up, and that might have been the command I was remembering. But that "shortcut" is defined in my package.json as simply "scripts":{"build": "webpack"}. Both ways work without the unexpected error, but mixing up the two will cause trouble.

natevw
  • 16,807
  • 8
  • 66
  • 90