<h1 dir="auto">Bug report</h1>




<p dir="auto"><strong>What is the current behavior?</strong></p>
<p dir="auto">I set devtool: eval-nosources-source-map，after run build, i found  source code still in sourcesContent</p>
<p dir="auto"><strong>If the current behavior is a bug, please provide the steps to reproduce.</strong></p>
<p dir="auto">1、my source code</p>
<p dir="auto"><a href="https://github.com/rootegg/test-webpack">https://github.com/rootegg/test-webpack</a></p>
<p dir="auto">2、set webpack.config.js as blow</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="module.exports = {
  devtool: &quot;eval-nosources-source-map&quot;,
  mode: &quot;production&quot;,
  module: {
    rules: [
      {
        test: /.js$/,
        exclude: /node_modules/,
        use: &quot;babel-loader&quot;,
      },
    ],
  },
};"><pre class="notranslate"><code class="notranslate">module.exports = {
  devtool: "eval-nosources-source-map",
  mode: "production",
  module: {
    rules: [
      {
        test: /.js$/,
        exclude: /node_modules/,
        use: "babel-loader",
      },
    ],
  },
};
</code></pre></div>
<p dir="auto">3、run webpack command, get output as blow</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="(() =&gt; {
  var __webpack_modules__ = {
      579: () =&gt; {
        eval(
          &quot;var fn = function fn(b) {\n  return console.log(b, a);\n};\nfn(11);//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiNTc5LmpzIiwibmFtZXMiOlsiZm4iLCJiIiwiY29uc29sZSIsImxvZyIsImEiXSwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsid2VicGFjazovL3Rlc3Qtd2VicGFjazUvLi9zcmMvaW5kZXguanM/YjYzNSJdLCJzb3VyY2VzQ29udGVudCI6WyJjb25zdCBmbiA9IChiKSA9PiBjb25zb2xlLmxvZyhiLCBhKTtcclxuZm4oMTEpO1xyXG4iXSwibWFwcGluZ3MiOiJBQUFBLElBQU1BLEVBQUUsR0FBRyxTQUFMQSxFQUFFLENBQUlDLENBQUM7RUFBQSxPQUFLQyxPQUFPLENBQUNDLEdBQUcsQ0FBQ0YsQ0FBQyxFQUFFRyxDQUFDLENBQUM7QUFBQTtBQUNuQ0osRUFBRSxDQUFDLEVBQUUsQ0FBQyJ9\n//# sourceURL=webpack-internal:///579\n&quot;
        );
      },
    },
    __webpack_exports__ = {};
  __webpack_modules__[579]();
})();"><pre class="notranslate"><code class="notranslate">(() =&gt; {
  var __webpack_modules__ = {
      579: () =&gt; {
        eval(
          "var fn = function fn(b) {\n  return console.log(b, a);\n};\nfn(11);//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiNTc5LmpzIiwibmFtZXMiOlsiZm4iLCJiIiwiY29uc29sZSIsImxvZyIsImEiXSwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsid2VicGFjazovL3Rlc3Qtd2VicGFjazUvLi9zcmMvaW5kZXguanM/YjYzNSJdLCJzb3VyY2VzQ29udGVudCI6WyJjb25zdCBmbiA9IChiKSA9PiBjb25zb2xlLmxvZyhiLCBhKTtcclxuZm4oMTEpO1xyXG4iXSwibWFwcGluZ3MiOiJBQUFBLElBQU1BLEVBQUUsR0FBRyxTQUFMQSxFQUFFLENBQUlDLENBQUM7RUFBQSxPQUFLQyxPQUFPLENBQUNDLEdBQUcsQ0FBQ0YsQ0FBQyxFQUFFRyxDQUFDLENBQUM7QUFBQTtBQUNuQ0osRUFBRSxDQUFDLEVBQUUsQ0FBQyJ9\n//# sourceURL=webpack-internal:///579\n"
        );
      },
    },
    __webpack_exports__ = {};
  __webpack_modules__[579]();
})();
</code></pre></div>
<p dir="auto">4、use window.btoa get source-map file content</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="atob('eyJ2ZXJzaW9uIjozLCJmaWxlIjoiNTc5LmpzIiwibmFtZXMiOlsiZm4iLCJiIiwiY29uc29sZSIsImxvZyIsImEiXSwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsid2VicGFjazovL3Rlc3Qtd2VicGFjazUvLi9zcmMvaW5kZXguanM/YjYzNSJdLCJzb3VyY2VzQ29udGVudCI6WyJjb25zdCBmbiA9IChiKSA9PiBjb25zb2xlLmxvZyhiLCBhKTtcclxuZm4oMTEpO1xyXG4iXSwibWFwcGluZ3MiOiJBQUFBLElBQU1BLEVBQUUsR0FBRyxTQUFMQSxFQUFFLENBQUlDLENBQUM7RUFBQSxPQUFLQyxPQUFPLENBQUNDLEdBQUcsQ0FBQ0YsQ0FBQyxFQUFFRyxDQUFDLENBQUM7QUFBQTtBQUNuQ0osRUFBRSxDQUFDLEVBQUUsQ0FBQyJ9')"><pre class="notranslate"><code class="notranslate">atob('eyJ2ZXJzaW9uIjozLCJmaWxlIjoiNTc5LmpzIiwibmFtZXMiOlsiZm4iLCJiIiwiY29uc29sZSIsImxvZyIsImEiXSwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsid2VicGFjazovL3Rlc3Qtd2VicGFjazUvLi9zcmMvaW5kZXguanM/YjYzNSJdLCJzb3VyY2VzQ29udGVudCI6WyJjb25zdCBmbiA9IChiKSA9PiBjb25zb2xlLmxvZyhiLCBhKTtcclxuZm4oMTEpO1xyXG4iXSwibWFwcGluZ3MiOiJBQUFBLElBQU1BLEVBQUUsR0FBRyxTQUFMQSxFQUFFLENBQUlDLENBQUM7RUFBQSxPQUFLQyxPQUFPLENBQUNDLEdBQUcsQ0FBQ0YsQ0FBQyxFQUFFRyxDQUFDLENBQUM7QUFBQTtBQUNuQ0osRUFBRSxDQUFDLEVBQUUsQ0FBQyJ9')
</code></pre></div>
<p dir="auto">=&gt;</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="'{&quot;version&quot;:3,&quot;file&quot;:&quot;579.js&quot;,&quot;names&quot;:[&quot;fn&quot;,&quot;b&quot;,&quot;console&quot;,&quot;log&quot;,&quot;a&quot;],&quot;sourceRoot&quot;:&quot;&quot;,&quot;sources&quot;:[&quot;webpack://test-webpack5/./src/index.js?b635&quot;],&quot;sourcesContent&quot;:[&quot;const fn = (b) =&gt; console.log(b, a);\\r\\nfn(11);\\r\\n&quot;],&quot;mappings&quot;:&quot;AAAA,IAAMA,EAAE,GAAG,SAALA,EAAE,CAAIC,CAAC;EAAA,OAAKC,OAAO,CAACC,GAAG,CAACF,CAAC,EAAEG,CAAC,CAAC;AAAA;AACnCJ,EAAE,CAAC,EAAE,CAAC&quot;}'"><pre class="notranslate"><code class="notranslate">'{"version":3,"file":"579.js","names":["fn","b","console","log","a"],"sourceRoot":"","sources":["webpack://test-webpack5/./src/index.js?b635"],"sourcesContent":["const fn = (b) =&gt; console.log(b, a);\\r\\nfn(11);\\r\\n"],"mappings":"AAAA,IAAMA,EAAE,GAAG,SAALA,EAAE,CAAIC,CAAC;EAAA,OAAKC,OAAO,CAACC,GAAG,CAACF,CAAC,EAAEG,CAAC,CAAC;AAAA;AACnCJ,EAAE,CAAC,EAAE,CAAC"}'
</code></pre></div>






<p dir="auto"><strong>What is the expected behavior?</strong></p>
<p dir="auto">I expected sourcesContent to be empty，same as  <code class="notranslate">source code not included</code></p>


<p dir="auto"><strong>Other relevant information:</strong><br>
webpack version:  5.74.0<br>
Node.js version: 16.17.0<br>
erating System: win10<br>
Additional tools:</p>
<h1 dir="auto">Bug report</h1>




<p dir="auto"><strong>What is the current behavior?</strong></p>
<p dir="auto">The source map string converted by the base64 output of <code class="notranslate">devtool: 'eval-nosources-source-map'</code> still  contains the <code class="notranslate">sourcesContent</code> field.</p>
<p dir="auto"><strong>If the current behavior is a bug, please provide the steps to reproduce.</strong></p>
<p dir="auto">Here is a minimal reproduce:</p>
<div class="highlight highlight-source-js notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="module.exports = {
  entry: './src/index.js',
  output: {
    filename: 'main.js',
    path: path.resolve(__dirname, 'dist'),
  },
  mode: 'development',
  devtool: 'eval-nosources-source-map', // &lt;----- here
};"><pre class="notranslate"><span class="pl-smi">module</span><span class="pl-kos">.</span><span class="pl-c1">exports</span> <span class="pl-c1">=</span> <span class="pl-kos">{</span>
  <span class="pl-c1">entry</span>: <span class="pl-s">'./src/index.js'</span><span class="pl-kos">,</span>
  <span class="pl-c1">output</span>: <span class="pl-kos">{</span>
    <span class="pl-c1">filename</span>: <span class="pl-s">'main.js'</span><span class="pl-kos">,</span>
    <span class="pl-c1">path</span>: <span class="pl-s1">path</span><span class="pl-kos">.</span><span class="pl-en">resolve</span><span class="pl-kos">(</span><span class="pl-s1">__dirname</span><span class="pl-kos">,</span> <span class="pl-s">'dist'</span><span class="pl-kos">)</span><span class="pl-kos">,</span>
  <span class="pl-kos">}</span><span class="pl-kos">,</span>
  <span class="pl-c1">mode</span>: <span class="pl-s">'development'</span><span class="pl-kos">,</span>
  <span class="pl-c1">devtool</span>: <span class="pl-s">'eval-nosources-source-map'</span><span class="pl-kos">,</span> <span class="pl-c">// &lt;----- here</span>
<span class="pl-kos">}</span><span class="pl-kos">;</span></pre></div>
<div class="highlight highlight-source-js notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="const output = /* copy the base64 of source map from dist */
console.log(Buffer.from(output, 'base64').toString('utf-8')) // still contains the `sourcesContent` field"><pre class="notranslate"><span class="pl-k">const</span> <span class="pl-s1">output</span> <span class="pl-c1">=</span> <span class="pl-c">/* copy the base64 of source map from dist */</span>
<span class="pl-smi">console</span><span class="pl-kos">.</span><span class="pl-en">log</span><span class="pl-kos">(</span><span class="pl-v">Buffer</span><span class="pl-kos">.</span><span class="pl-en">from</span><span class="pl-kos">(</span><span class="pl-s1">output</span><span class="pl-kos">,</span> <span class="pl-s">'base64'</span><span class="pl-kos">)</span><span class="pl-kos">.</span><span class="pl-en">toString</span><span class="pl-kos">(</span><span class="pl-s">'utf-8'</span><span class="pl-kos">)</span><span class="pl-kos">)</span> <span class="pl-c">// still contains the `sourcesContent` field</span></pre></div>






<p dir="auto"><strong>What is the expected behavior?</strong></p>
<p dir="auto">Don't contains the <code class="notranslate">sourcesContent</code> field since the <code class="notranslate">nosources</code> is used.</p>


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