bharath muppa bharath muppa - 20 days ago 10
React JSX Question

Error in MultiMain could not resolve directory webpack issue

I know this issue is prevalent but the best part is it differs from person to person

While running webpack server

In my case my folder structure is
Folder Structure

My files:
Webpack.config.js

var path = require('path');
var webpack = require('webpack');
const Files = {
input: path.resolve(__dirname,'src/app'),
output: path.resolve(__dirname,'output')
}
console.log(Files.input);
var config = {
entry: Files.input,
output: {
path: Files.output,
filename: 'index.js',
},
devServer: {
inline: true,
port: 9009
},
resolve: { modulesDirectories: ['node_modules', 'src'], extensions: ['','.js','.jsx'] },
stats: {
colors: true,
modules: true,
reasons: true,
errorDetails: true
},
module: {
loaders: [{
test: /\.jsx?$/,
exclude: /node_modules/,
loader: 'babel',
query: {
presets: ['es2015', 'react']
}
}]
}
}

module.exports = config;


Package.json

{
"name": "reactapp",
"version": "1.0.0",
"description": "",
"main": "output/index.js",
"scripts": {
"start": "webpack-dev-server --hot"
},
"author": "batman",
"license": "AMIGOS",
"dependencies": {
"babel-cli": "^6.0.0",
"babel-core": "^6.17.0",
"babel-loader": "^6.2.5",
"babel-preset-es2015": "^6.16.0",
"babel-preset-react": "^6.16.0",
"react": "^15.3.2",
"react-dom": "^15.3.2",
"webpack": "^1.13.2",
"webpack-dev-server": "^1.16.2"
}
}


I have kept package.json in my app folder too with dummy json
{"name":"hello"}

as part of suggestion from one of developer. I have tried all the possible scenarios which are in my vicinity but in vain.
Please shed some light on this.

Update:
with change of folder from !bharath to bharath error reduced to 1.

Answer
const Files = {
  // you need to specify the file name as well as webpack entry
  input: path.resolve(__dirname,'src/app/main.js'), 
  output: path.resolve(__dirname,'output')
}
Comments