title: The bundled js file created by webpack is not running on another server
body: <p>Server1 created a bundle.js file using webpack and it runs perfectly on Server1.</p>
  <p>Assume my js file is like this:</p>
  <pre><code>import { startExample } from './components/MyExample';
  
  alert(&quot;POC worked!&quot;);
  startExample();
  </code></pre>
  <p>And startExample is doing a simple job like another alert.</p>
  <p>Application2 loads the same js file using Server1 as a cloud that serves js files. But it doesn't run that when I put it in <code>&lt;script&gt;&lt;/script&gt;</code> tag in html. The file that is being loaded is in the format of a minified js file starting with <code>&quot;window.webpackJsonp = ...&quot;</code>.</p>
  <p>My goal is that bundle.js runs on Application2.</p>
  <p>My understanding is that some packages or js files are missing on my html file on Application2 so that it understands what this minified strange syntax of <code>webpackJsonP</code> means? But I cannot figure out what that is?</p>
  <p>Server1 is a ASP.Net Core application with standard folder structures. Webpack creates bundle.js under wwwroot/Scripts/bundle.js. Assume a cshtml file on Server1 add bundle.js (and some other dependencies) and it works perfectly there.</p>
  <p>I followed <a href="https://stackoverflow.com/questions/58955158/independent-custom-webpack-config-without-the-webpackjsonp">this post</a>. It removed the <code>webpackJsonP</code> part of the created bundle.js file. the new bundle.js file starts like this:</p>
  <pre><code>!function(e) {
      function t(t) {
  </code></pre>
  <p>but it still doesn't run on Application2.</p>
  <p>My original file is a <code>tsx</code> file. I tried to use <code>tsc</code> and a <code>tsConfig.js</code> file to translate that one file  into one js file (I put all the code in one file instead of having separate modules) and used the new js file in my Application2 html. I was thinking maybe my Application2 somehow doesn't understand the syntax. I used <code>amd</code> module in my <code>tsConfig</code> which I know is being used in Application2 in other places. This new file starts like this</p>
  <pre><code>var __importDefault = (this &amp;&amp; this.__importDefault) || function (mod) {
      return (mod &amp;&amp; mod.__esModule) ? mod : { &quot;default&quot;: mod };
  };
  define([&quot;require&quot;, &quot;exports...
  </code></pre>
  <p>This didn't work either. I added an alert before the js generated code:</p>
  <pre><code>alert(&quot;This is before tsc translate tsx to js!&quot;);
  var __importDefault = (this &amp;&amp; this.__importDefault) || function (mod) {
      return (mod &amp;&amp; mod.__esModule) ? mod : { &quot;default&quot;: mod };
  };...
  </code></pre>
  <p>The added alert works, but the compiled js (either compiled by <code>webpack</code> or <code>tsc</code>) doesn't work so far.</p>
  <p>I think I need to export something in my original js file and import and call the function in Application2 in order for it to work. Not sure how.</p>