title: Uncaught ReferenceError: __webpack_require__ is not defined Deploying to server
body: <p>I am getting this error when logging into our dev site. This is a part of our migration from .NET framework 4.5.2 to 4.7.2. Though I do not think that has much to do with it. If we publish straight from VS, the page loads fine. If it uses our pipeline, or we did not clear our dirs beforehand, we get this error (in the console browser).</p>
  <blockquote>
  <p>ie-polyfill_aurelia-bootstrapper:1 Uncaught ReferenceError:
  <strong>webpack_require</strong> is not defined
  at eval (ie-polyfill_aurelia-bootstrapper:1)
  at Object.0 (xxxAppScripts?v=sRzkW2d1FsbC87Brht0ZS8CXZDQaGBaky9ddApOJOaY1:1)
  at t (xxxAppScripts?v=sRzkW2d1FsbC87Brht0ZS8CXZDQaGBaky9ddApOJOaY1:1)
  at xxxAppScripts?v=sRzkW2d1FsbC87Brht0ZS8CXZDQaGBaky9ddApOJOaY1:1
  at xxxAppScripts?v=sRzkW2d1FsbC87Brht0ZS8CXZDQaGBaky9ddApOJOaY1:1</p>
  </blockquote>
  <p>The process of our build should be exactly the same as building with NPM locally, and there are no errors given in the build process. Build is defined for both in the webpack.config.js as follows</p>
  <pre><code>const path = require('path');
  const CopyWebpackPlugin = require('copy-webpack-plugin');
  const ExtractTextPlugin = require('extract-text-webpack-plugin');
  const { AureliaPlugin, ModuleDependenciesPlugin } = require('aurelia-webpack-plugin');
  const UglifyJsPlugin = require('uglifyjs-webpack-plugin');
  const { ProvidePlugin, SourceMapDevToolPlugin } = require('webpack')
  const { TsConfigPathsPlugin, CheckerPlugin } = require('awesome-typescript-loader');
  const CleanWebpackPlugin = require('clean-webpack-plugin');
  // config helpers:
  const ensureArray = (config) =&gt; config &amp;&amp; (Array.isArray(config) ? config : [config]) || []
  const when = (condition, config, negativeConfig) =&gt;
      condition ? ensureArray(config) : ensureArray(negativeConfig)
  // primary config:
  const title = 'XXXXXX';
  const outDir = path.resolve(__dirname, 'Scripts', 'pub');
  const srcDir = path.resolve(__dirname, 'App');
  const nodeModulesDir = path.resolve(__dirname, 'node_modules');
  const baseUrl = '/';
  var isDevBuild = true;
  var dev;
  
  if (process.env.NODE_ENV) {
      dev = process.env.NODE_ENV.trim();
      if (dev === &quot;production&quot;) {
          isDevBuild = true;
      }
  }
  const cssRules = [
      { loader: 'css-loader' },
      {
          loader: 'postcss-loader',
          options: { plugins: () =&gt; [require('autoprefixer')({ browsers: ['last 2 versions'] })] }
      },
      'sass-loader'
  ];
  
  module.exports = ({ production, server, extractCss, coverage } = {}) =&gt; ({
      resolve: {
          extensions: ['.ts', '.js'],
          modules: [srcDir, 'node_modules'],
          plugins: [
              new TsConfigPathsPlugin(),
          ],
          alias: {
              // Enforce single aurelia-binding, to avoid v1/v2 duplication due to
              // out-of-date dependencies on 3rd party aurelia plugins
                          'aurelia-binding': path.resolve(__dirname, 'node_modules/aurelia-binding'),
                          'aurelia-bootstrapper': path.resolve(__dirname, 'node_modules/aurelia-bootstrapper')
          }
      },
  
      entry: {
          app: ['./ie-polyfill', 'aurelia-bootstrapper'],
          vendor: ['jquery'],
      },
  
      output: {
          path: outDir,
          publicPath: baseUrl,
          filename: production ? '[name].[chunkhash].bundle.js' : '[name].[hash].bundle.js',
          sourceMapFilename: production ? '[name].[chunkhash].bundle.map' : '[name].[hash].bundle.map',
          chunkFilename: production ? '[chunkhash].chunk.js' : '[hash].chunk.js',
      },
      devServer: {
          contentBase: baseUrl,
          // serve index.html for all 404 (required for push-state)
          historyApiFallback: '/',
      },
      module: {
          rules: [
              {
                  test: /\.css$/i,
                  issuer: [{ not: [{ test: /\.html$/i }] }],
                  use: extractCss ? ExtractTextPlugin.extract({
                      fallback: 'style-loader',
                      use: cssRules,
                  }) : ['style-loader', ...cssRules],
              },
              {
                  test: /\.css$/i,
                  issuer: [{ test: /\.html$/i }],
                  // CSS required in templates cannot be extracted safely
                  // because Aurelia would try to require it again in runtime
                  use: cssRules,
              },
              {
                  test: /\.scss$/,
                  exclude: /node_modules/,
                  use: ExtractTextPlugin.extract({
                      use: ['css-loader', 'sass-loader']
                  })
              },
              { test: /\.html$/i, loader: 'html-loader' },
  
              { test: /\.ts$/i, loader: 'awesome-typescript-loader', exclude: nodeModulesDir },
              {
                  test: require.resolve(&quot;jquery&quot;),
                  use: [
                      {
                          loader: &quot;expose-loader&quot;,
                          options: &quot;$&quot;
                      }
                  ]
              }
          ]
      },
      plugins: [
  
  
          new CleanWebpackPlugin(),
  
          // required polyfills for non-evergreen browsers
          new ProvidePlugin({
              Map: 'core-js/es6/map',
              WeakMap: 'core-js/es6/weak-map',
              Promise: 'core-js/es6/promise',
              regeneratorRuntime: 'regenerator-runtime' // to support await/async syntax
          }),
          new AureliaPlugin({
              aureliaApp: 'main'
          }),
  
          new ProvidePlugin({
              '$': 'jquery',
              'jQuery': 'jquery',
              'window.jQuery': 'jquery',
          }),
  
          new CheckerPlugin(),
  
          new ExtractTextPlugin({
              filename: production ? '[contenthash].css' : 'style-[id].css',
              allChunks: true,
          }),
  
  
  
  
      ].concat(isDevBuild ? [
          new SourceMapDevToolPlugin({
              filename: '[file].map', // Remove this line if you prefer inline source maps
              moduleFilenameTemplate: path.relative(outDir, '[resourcePath]')  // Point sourcemap entries to the original file locations on disk
          })
      ] : [
              new UglifyJsPlugin()
          ]),
  })
  </code></pre>
  <p>There do seem to be a few times a similar question has been asked, but there has not been a solution that worked. Thanks for any help provided.</p>