Reputation: 362
I'm receiving an error when attempting to build my application via webpack 2.
My app folder structure looks like this:
/
| - dist/
|
| - src/
| |
| | - modules/
| | |
| | | - module1.js
| |
| | - index.js *
|
| _ webpack.config.js
|
| - package.json
The relevant portion of my webpack.config.js
file is here:
/**
* Requires
*/
const path = require('path');
/**
* Variables
*/
const PATHS = {
src: path.join(__dirname, 'src'),
dist: path.join(__dirname, 'dist')
};
/**
* Configuration
*/
module.exports = {
entry: {
context: PATHS.src,
main: './index.js'
},
....
}
When I run npm run build
, which is my script alias for webpack --display-error-details
, I receive the following error details:
ERROR in Entry module not found: Error: Can't resolve './index.js' in <my project path>
resolve './index.js' in <my project path>
using description file: <my project path>/package.json (relative path: .)
Field 'browser' doesn't contain a valid alias configuration
Now, I'm slowly learning webpack and this could very well be a simple misunderstanding of how webpack's context
property works. PATHS.src
equals the absolute path of my project's src
directory, and my entry point is ./index.js
, which is inside of that directory. Can anybody help me identify why I'm receiving this error?
Thanks!
Upvotes: 1
Views: 2824