2
votes

I have a React project where the root dir has an app directory. Inside the app directory, there is a containers and a components directory. How do I change the following so that webpack actually looks in the directory where my entry point is, for modules.

const path = require('path')
const HtmlWebpackPlugin = require('html-webpack-plugin');

const PATHS = {
  app: path.join(__dirname, 'app'),
  build: path.join(__dirname, 'build'),
};

module.exports = {
  // where to start bundling
  entry: [
    './app/app.js',
  ],

  // where to output
  output: {
    // output to same dir
    path: PATHS.build,
    filename: 'timbundle.js',
  },
1
I don’t see the relevance of Brainfuckgurghet
It would seem like your current entry definition should be imported. Do you want to have multiple entry points that exist under containers or components?Gabriel Kohen
I think that every file in the modules should be referenced either directly by an app.js import or through a reference from another file. The project is derived from the react-boilerplate repo but I having to build a new webpack config to resolve why some references are not being included.timbo

1 Answers

2
votes
resolve: {
     modules: ['app', 'node_modules'],
     extensions: ['.js']
},

appears to work.