<p dir="auto">I am the author of <a href="https://github.com/s-panferov/awesome-typescript-loader">https://github.com/s-panferov/awesome-typescript-loader</a> and I have a problem with my async loader:</p>
<p dir="auto">Pseudo-code:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="let callback = this.async();

/* inside promise handler */
try {
    callback(null, result.text, sourceMap);
} catch(e) {
    console.error('Caught', e)
    // I'm here! What I need to do in that case?  
}"><pre class="notranslate"><code class="notranslate">let callback = this.async();

/* inside promise handler */
try {
    callback(null, result.text, sourceMap);
} catch(e) {
    console.error('Caught', e)
    // I'm here! What I need to do in that case?  
}
</code></pre></div>
<p dir="auto">Console output:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="Caught { [ModuleParseError: Module parse failed: /Users/panferov-s/Workspace/arui/node_modules/react-hot-loader/index.js!/Users/panferov-s/Workspace/awesome-typescript-loader/dist/index.js?compiler=ntypescript&amp;rewriteImports=arui&amp;module=commonjs!/Users/panferov-s/Workspace/arui/src/popup/common/popup.ts Line 112: Unexpected token ,
You may need an appropriate loader to handle this file type.
|             || nextAttachment !== attachment) {
|             this.setState({
|                 attachment: ,
|                 targetAttachment: ,
]             });

/** stripped */"><pre class="notranslate"><code class="notranslate">Caught { [ModuleParseError: Module parse failed: /Users/panferov-s/Workspace/arui/node_modules/react-hot-loader/index.js!/Users/panferov-s/Workspace/awesome-typescript-loader/dist/index.js?compiler=ntypescript&amp;rewriteImports=arui&amp;module=commonjs!/Users/panferov-s/Workspace/arui/src/popup/common/popup.ts Line 112: Unexpected token ,
You may need an appropriate loader to handle this file type.
|             || nextAttachment !== attachment) {
|             this.setState({
|                 attachment: ,
|                 targetAttachment: ,
]             });

/** stripped */
</code></pre></div>
<p dir="auto">Versions:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="    &quot;webpack&quot;: &quot;^1.10.1&quot;,
    &quot;webpack-dev-server&quot;: &quot;^1.10.1&quot;"><pre class="notranslate"><code class="notranslate">    "webpack": "^1.10.1",
    "webpack-dev-server": "^1.10.1"
</code></pre></div>
<p dir="auto">The big problem here is that compilation freezes in webpack-dev-server</p>
<h1 dir="auto">Bug report</h1>




<p dir="auto"><strong>What is the current behavior?</strong><br>
When the definitions by <code class="notranslate">webpack.definePlugin</code> are being used in any module, It's not accessing the definitions from the reference but importing and duplicating them for each module.  Also, increasing garbage collection load cumulatively according to definition size. (Assume that, a big json file used for global definition)</p>
<p dir="auto"><strong>If the current behavior is a bug, please provide the steps to reproduce.</strong><br>
I created a minimum reproducible repo. You can check the output -<code class="notranslate">main.js</code>- and it's content. Clearly visible that, the settings object is duplicated.</p>
<p dir="auto"><a href="https://github.com/tugayilik/webpack-defineplugin">https://github.com/tugayilik/webpack-defineplugin</a></p>






<p dir="auto"><strong>What is the expected behavior?</strong><br>
Not to duplicate values for each module and decreasing the garbage collection load.</p>


<p dir="auto"><strong>Other relevant information:</strong><br>
webpack version:  5.31.2<br>
Node.js version: 15.13.0<br>
Operating System: macOS<br>
Additional tools: -</p>