Friday, 26 May 2017

Webpack entry point path with npm run vs cli run

I have the following folder structure:

/
  package.json
  nested
    webpack.conf.js
    package.json
    index.js

I want to run the webpack build from the root level. So part of the root package.json looks like this:

"scripts": {
  "build": "cd nested; webpack --config webpack.conf.js"
}

The webpack config file contains the following entry point:

entry: './index.js'

The problem is, that I keep getting "entry file not found" error every time I try to run it with npm run build. When I execute the command in the CLI from the package.json like:

cd nested; webpack --config webpack.conf.js

Everything works perfectly. What's wrong?

The exact error is:

ERROR in Entry module not found: Error: Cannot resolve 'file' or 'directory' ./index.js in /Users/test/Project/nested



via user99999

No comments:

Post a Comment