title: Angular "Module is not available" when switching to webpack
body: <p>My project is trying to switch from pure Javascript scripts to webpack. We have an html file, game.html, that has the following content:</p>
  
  <pre><code>&lt;html&gt;
      ...
      &lt;script src="bundle.js"&gt;&lt;/script&gt;
      ...
      &lt;div ng-app="visualizerApp" ng-controller="VisualizerController as ctrl"&gt;
          ...
      &lt;/div&gt;
      ...
  &lt;/html&gt;
  </code></pre>
  
  <p>before switching to webpack, we just had a long list of scripts.</p>
  
  <p>The angular module is created in a file app.js</p>
  
  <pre><code>import angular from 'angular';
  
  class VisualizerController {...}
  
  VisualizerController.$inject = ['$scope', '$rootScope'];
  
  angular.module('visualizerApp', []).controller('VisualizerController', VisualizerController);
  </code></pre>
  
  <p>before switching, the file was identical except for the import statement. </p>
  
  <p>When opening the html file, we get an error in the console:</p>
  
  <pre><code>[$injector:modulerr] Failed to instantiate module visualizerApp due to:
  Error: [$injector:nomod] Module 'visualizerApp' is not available! You either misspelled the module name or forgot to load it. If registering a module ensure that you specify the dependencies as the second argument.
  </code></pre>
  
  <p>Why does this happen and how can I solve it?</p>
  
  <p>edit: my webpack.config.js</p>
  
  <pre><code>const path = require('path');
  const mapType = require('./root/visualizer/js/map/PluginManager').mapType;
  
  
  module.exports = {
      entry: './plugins/root/visualizer/js/main.js',
      output: {
          filename: '../game_logs/bundle.js'
      },
      module: {
          rules: [
              {
                  test: /\.js$/,
                  exclude: /tests/,
                  use: {
                      loader: 'babel-loader',
                      options: {
                          presets: ['babel-preset-env']
                      }
                  }
              }
          ]
      },
      resolve: {
          alias: {
              mapPlugin: path.resolve(__dirname, 'map/' + mapType),
          }
      }
  };
  </code></pre>
  
  <p>library versions:</p>
  
  <pre><code>├── angular@1.6.8
  ├── babel-cli@6.26.0
  ├── babel-loader@7.1.2
  └── webpack@3.10.0
  </code></pre>