title: Tap into webpack resolve/loader to add fallback
body: <p>I have a react app (student-portal). </p>
  
  <p>My folder structure is as follows:</p>
  
  <pre><code>\- build
    - webpack.config.js
  \- src
    - App.js
    - components\
      - Login\
        - Login.scss
        - Login.js
      - Dashboard\
      - Register\
    - redux\
    - helpers\ 
  </code></pre>
  
  <p>My webpack is pretty standard.</p>
  
  <pre><code> var path = require('path');
   var webpack = require('webpack');
   module.exports = {
       entry: './src/app.js',
       output: {
           path: path.resolve(__dirname, 'build'),
           filename: 'app.bundle.js'
       },
       module: {
           loaders: [
               {
                   test: /\.js$/,
                   loader: 'babel-loader',
                   query: {
                       presets: ['es2015']
                   }
               }
           ]
       },
       stats: {
           colors: true
       },
       devtool: 'source-map'
   };
  </code></pre>
  
  <p>I want to build on top of this app. So I published this app to npm (local). My folder structure is now:</p>
  
  <pre><code>\- node_modules
    - student-portal\
  \ - src\
  \ - build\
  </code></pre>
  
  <p>What I would like is an ability to replace/extend existing components and not have to copy the existing files.</p>
  
  <p>So, if I create a new file, I want webpack to use it. If this file doesn't exist, it should look into <code>node_modules/student-portal\src</code>.</p>
  
  <p>So webpack should look into <code>src</code> file first and then into <code>node_modules\student-portal\src</code>.</p>
  
  <p>I tried creating a resolver function:</p>
  
  <pre><code>var MyResolver = {
    apply: function(resolver) {
      resolver.plugin('module', function(request, callback) {
        console.log(request.request); // this only consoles node_modules not .js files
      });
    }
  };
  
  
  </code></pre>
  
  <p>But this doesn't console .js files. I also played around with number of other plugins like NormalModuleReplacementPlugin, ResolverPlugin etc with no success.</p>
  
  <p>Any pointer on how I can tap into webpack resolve and replace path if file doesn't exist would be very much appreciated. Ideally I would like to extend existing components and have webpack replace path to old component with path to new component.</p>