title: Webpack: Module not found: Error: Can't resolve './containers'
body: <p>I want to link react project to python Flask, so I used webpack.</p>
  
  <p>But, I have the following error in webpack:</p>
  
  <p><strong>ERROR in ./web/app.js</strong></p>
  
  <p><strong>Module not found: Error: Can't resolve '/containers'</strong></p>
  
  <p>I don't know if there's an error in the path or the syntax is wrong.</p>
  
  <p>How do I solve this problem?</p>
  
  <p>This project is constructed like below:</p>
  
  <pre><code>templete
  |--- index.html
  static
  web
  |--- app.js
  |--- containers
      |--- First.js
      |---Second.js
  app.py
  package.json
  webpack.config.js
  requirements.txt
  </code></pre>
  
  <p>webpack.config.js:</p>
  
  <pre><code>const path = require("path")
  const MiniCssExtractPlugin  = require("mini-css-extract-plugin")
  
  module.exports = {
      mode: "development",
      entry: [
          '@babel/polyfill',
          "./web/app.js"
      ],
      output: {
          filename: "flask_react_router.js",
          path: path.resolve(__dirname, "static"),
          publicPath: "/static/"
      },
      module: {
          rules: [
              {
                  test: /\.(sa|sc|c)ss$/,
                  use: [
                      MiniCssExtractPlugin.loader,
                      'css-loader'
                  ]
              },
              {
                  test: /\.m?js$/,
                  exclude: /(node_modules|bower_components)/,
                  use: [{
                      loader: "babel-loader",
                      options: {
                          presets: ["@babel/preset-env", "@babel/preset-react"],
                          plugins: [
                              ['@babel/plugin-proposal-decorators', {legacy: true}],
                              ['@babel/plugin-proposal-class-properties', {loose: true}]
                          ]
                      }
                  }]
              },
              {
                  test: /\.(png|jpg|ico|svg|eot|woff|woff2|ttf)$/,
                  use: ['file-loader']
              }
          ]
      },
      plugins: [
          new MiniCssExtractPlugin({
              filename: "flask_react_router.css",
              chunkFilename: "[id].css"
          })
      ]
  }
  </code></pre>
  
  <p>app.js:</p>
  
  <pre><code>import '@babel/polyfill'
  import React from 'react'
  import ReactDOM from 'react-dom'
  import { BrowserRouter, Route } from 'react-router-dom'
  import { First, Second } from './containers'
  
  ReactDOM.render(
      &lt;BrowserRouter&gt;
          &lt;Route exact path='/first' component={ First } /&gt;
          &lt;Route exact path='/second' component={ Second } /&gt;
      &lt;/BrowserRouter&gt;
      , document.getElementById('root')
  );
  </code></pre>
  
  <p>First.js:</p>
  
  <pre><code>import React, { Component } from 'react'
  
  export default class First extends Component {
      render() {
          return (
              &lt;div&gt;Hello First&lt;/div&gt;
          )
      }
  }
  </code></pre>
  
  <p>index.html:</p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html lang="en"&gt;
  &lt;head&gt;
      &lt;meta charset="UTF-8"&gt;
      &lt;meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"&gt;
      &lt;meta name="author" content="kimkkikki"&gt;
      &lt;title&gt;Flask React Router&lt;/title&gt;
  
      &lt;link rel="stylesheet" href="{{ url_for('static', filename='flask_react_router.css') }}"&gt;
  &lt;/head&gt;
  &lt;body&gt;
  &lt;div id="root"&gt;&lt;/div&gt;
  &lt;/body&gt;
  &lt;script type="text/javascript" src="{{ url_for('static', filename='flask_react_router.js') }}"&gt;&lt;/script&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>app.py:</p>
  
  <pre><code>from flask import Flask, render_template
  
  app = Flask(__name__)
  
  @app.route('/', defaults={'path': ''})
  @app.route('/&lt;path:path&gt;')
  def web(path):
      return render_template('index.html')
  
  if __name__ == '__main__':
      app.run(host='127.0.0.1')
  </code></pre>
  
  <p>And executable code:</p>
  
  <pre><code>webpack
  app.py
  </code></pre>
  
  <p>Can someone help this problem?</p>