<h3 dir="auto">Preflight Checklist</h3>
<ul class="contains-task-list">
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> I have read the <a href="https://github.com/electron/electron/blob/master/CONTRIBUTING.md">Contributing Guidelines</a> for this project.</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> I agree to follow the <a href="https://github.com/electron/electron/blob/master/CODE_OF_CONDUCT.md">Code of Conduct</a> that this project adheres to.</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> I have searched the issue tracker for an issue that matches the one I want to file, without success.</li>
</ul>
<h3 dir="auto">Issue Details</h3>
<ul dir="auto">
<li><strong>Electron Version:</strong>
<ul dir="auto">
<li>6.0.0-beta.13</li>
</ul>
</li>
<li><strong>Operating System:</strong>
<ul dir="auto">
<li>Windows 10 (1903)</li>
</ul>
</li>
<li><strong>Last Known Working Electron version:</strong></li>
</ul>
<ul dir="auto">
<li></li>
</ul>
<h3 dir="auto">Expected Behavior</h3>
<p dir="auto">Use the worker in the background thread.</p>
<h3 dir="auto">Actual Behavior</h3>
<p dir="auto">Webpack generated this 2 files:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="  dist_electron\index.js          2235.09 KiB           503.87 KiB
  dist_electron\test.worker.js    0.01 KiB              0.03 KiB"><pre class="notranslate"><code class="notranslate">  dist_electron\index.js          2235.09 KiB           503.87 KiB
  dist_electron\test.worker.js    0.01 KiB              0.03 KiB
</code></pre></div>
<p dir="auto">It compiled successfully.</p>
<p dir="auto">I use node 12.6.0 so i have worker_threads and vscode detect it fine.</p>
<p dir="auto">BUT when i launch electron i get this:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="App threw an error during load
ReferenceError: Worker is not defined
    at new ./node_modules/worker-loader/dist/cjs.js!./src/test.worker.ts.module.exports (c:\Users\myname\Desktop\my-project\dist_electron\index.js:56406:3)
    at Module../src/background.ts (c:\Users\myname\Desktop\my-project\dist_electron\index.js:60661:16)
    at __webpack_require__ (c:\Users\myname\Desktop\my-project\dist_electron\index.js:20:30)
    at Object.0 (c:\Users\myname\Desktop\my-project\dist_electron\index.js:60752:18)
    at __webpack_require__ (c:\Users\myname\Desktop\my-project\dist_electron\index.js:20:30)
    at c:\Users\myname\Desktop\my-project\dist_electron\index.js:84:18
    at Object.&lt;anonymous&gt; (c:\Users\myname\Desktop\my-project\dist_electron\index.js:87:10)
    at Module._compile (internal/modules/cjs/loader.js:815:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:827:10)
    at Module.load (internal/modules/cjs/loader.js:677:32)"><pre class="notranslate"><code class="notranslate">App threw an error during load
ReferenceError: Worker is not defined
    at new ./node_modules/worker-loader/dist/cjs.js!./src/test.worker.ts.module.exports (c:\Users\myname\Desktop\my-project\dist_electron\index.js:56406:3)
    at Module../src/background.ts (c:\Users\myname\Desktop\my-project\dist_electron\index.js:60661:16)
    at __webpack_require__ (c:\Users\myname\Desktop\my-project\dist_electron\index.js:20:30)
    at Object.0 (c:\Users\myname\Desktop\my-project\dist_electron\index.js:60752:18)
    at __webpack_require__ (c:\Users\myname\Desktop\my-project\dist_electron\index.js:20:30)
    at c:\Users\myname\Desktop\my-project\dist_electron\index.js:84:18
    at Object.&lt;anonymous&gt; (c:\Users\myname\Desktop\my-project\dist_electron\index.js:87:10)
    at Module._compile (internal/modules/cjs/loader.js:815:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:827:10)
    at Module.load (internal/modules/cjs/loader.js:677:32)
</code></pre></div>
<h3 dir="auto">To Reproduce</h3>
<p dir="auto"><code class="notranslate">npm install -g @vue/cli</code></p>
<p dir="auto"><code class="notranslate">vue create vue_app</code></p>
<p dir="auto"><code class="notranslate">cd vue_app</code><br>
<code class="notranslate">vue add electron-builder</code></p>
<p dir="auto">In <code class="notranslate">background.ts</code> i add this:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="import workerPath from &quot;file-loader?name=[name].js!./test.worker&quot;;
import { Worker } from 'worker_threads';

const worker = new Worker(workerPath);"><pre class="notranslate"><code class="notranslate">import workerPath from "file-loader?name=[name].js!./test.worker";
import { Worker } from 'worker_threads';

const worker = new Worker(workerPath);
</code></pre></div>
<p dir="auto">The file-loader module looks like this:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="declare module &quot;file-loader?name=[name].js!*&quot; {
    const value: string;
    export = value;
}"><pre class="notranslate"><code class="notranslate">declare module "file-loader?name=[name].js!*" {
    const value: string;
    export = value;
}
</code></pre></div>
<p dir="auto">The test.worker file is empty for the test.</p>
<p dir="auto">The last step is: <code class="notranslate">npm run serve:electron</code></p>
<h3 dir="auto">TS Config:</h3>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="{
  &quot;compilerOptions&quot;: {
    &quot;target&quot;: &quot;esnext&quot;,
    &quot;module&quot;: &quot;esnext&quot;,
    &quot;strict&quot;: true,
    &quot;jsx&quot;: &quot;preserve&quot;,
    &quot;importHelpers&quot;: true,
    &quot;moduleResolution&quot;: &quot;node&quot;,
    &quot;experimentalDecorators&quot;: true,
    &quot;esModuleInterop&quot;: true,
    &quot;allowSyntheticDefaultImports&quot;: true,
    &quot;sourceMap&quot;: true,
    &quot;baseUrl&quot;: &quot;.&quot;,
    &quot;types&quot;: [
      &quot;webpack-env&quot;,
      &quot;mocha&quot;,
      &quot;node&quot;,
    ],
    &quot;paths&quot;: {
      &quot;@/*&quot;: [
        &quot;src/*&quot;
      ]
    },
    &quot;lib&quot;: [
      &quot;esnext&quot;,
      &quot;es6&quot;,
      &quot;es7&quot;,
      &quot;dom&quot;,
      &quot;dom.iterable&quot;,
      &quot;scripthost&quot;
    ]
  },
  &quot;include&quot;: [
    &quot;src/**/*.ts&quot;,
    &quot;src/**/*.tsx&quot;,
    &quot;src/**/*.vue&quot;,
    &quot;tests/**/*.ts&quot;,
    &quot;tests/**/*.tsx&quot;
  ]
}"><pre class="notranslate"><code class="notranslate">{
  "compilerOptions": {
    "target": "esnext",
    "module": "esnext",
    "strict": true,
    "jsx": "preserve",
    "importHelpers": true,
    "moduleResolution": "node",
    "experimentalDecorators": true,
    "esModuleInterop": true,
    "allowSyntheticDefaultImports": true,
    "sourceMap": true,
    "baseUrl": ".",
    "types": [
      "webpack-env",
      "mocha",
      "node",
    ],
    "paths": {
      "@/*": [
        "src/*"
      ]
    },
    "lib": [
      "esnext",
      "es6",
      "es7",
      "dom",
      "dom.iterable",
      "scripthost"
    ]
  },
  "include": [
    "src/**/*.ts",
    "src/**/*.tsx",
    "src/**/*.vue",
    "tests/**/*.ts",
    "tests/**/*.tsx"
  ]
}
</code></pre></div>
<h3 dir="auto">Issue Details</h3>
<ul dir="auto">
<li><strong>Electron Version:</strong><br>
v5.0.2</li>
<li><strong>Operating System:</strong><br>
Windows 10</li>
</ul>
<h3 dir="auto">Expected Behavior</h3>
<p dir="auto">On app ready start nodejs worker which consoles string.</p>
<h3 dir="auto">Actual Behavior</h3>
<p dir="auto">App crash immediately after run</p>
<h3 dir="auto">To Reproduce</h3>
<ul dir="auto">
<li>git clone <a href="https://github.com/BorysTyminski/electron-issue.git">https://github.com/BorysTyminski/electron-issue.git</a></li>
<li>cd electron-issue</li>
<li>npm install</li>
<li>npm run start</li>
</ul>
<h3 dir="auto">Additional Information</h3>
<p dir="auto">I used electron-forge to quick build app.</p>