<p dir="auto">Files copied to '/static' using CopyWebpackPlugin are successfully created, but then are deleted right after the console messages 'Building page ...'.</p>


<ul class="contains-task-list">
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> I have searched the <a href="https://github.com/zeit/next.js/issues">issues</a> of this repository and believe that this is not a duplicate.</li>
</ul>
<h2 dir="auto">Expected Behavior</h2>


<p dir="auto">Files copied by CopyWebpackPlugin to '/static' don't subsequently get removed by the build process.</p>
<h2 dir="auto">Current Behavior</h2>


<p dir="auto">Files copied by CopyWebpackPlugin to '/static' get copied, then deleted by the build process.</p>
<h2 dir="auto">Steps to Reproduce (for bugs)</h2>


<p dir="auto">Run <code class="notranslate">npm run dev</code> with the following next.config.js (note that I'm copying a file from the <code class="notranslate">workbox-sw</code> npm package, but it can be any file):</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="const path = require('path')
const CopyWebpackPlugin = require('copy-webpack-plugin')

module.exports = {
  webpack: (config, { dev }) =&gt; {
    config.plugins.push(
      new CopyWebpackPlugin([
      {
        from: path.join(__dirname, 'node_modules/workbox-sw/build/importScripts/workbox-sw.dev.v2.1.2.js'),
        to: path.join(__dirname, 'static/scripts/workbox.js')
      }
    ]))
    
    return config
  }
}"><pre class="notranslate"><code class="notranslate">const path = require('path')
const CopyWebpackPlugin = require('copy-webpack-plugin')

module.exports = {
  webpack: (config, { dev }) =&gt; {
    config.plugins.push(
      new CopyWebpackPlugin([
      {
        from: path.join(__dirname, 'node_modules/workbox-sw/build/importScripts/workbox-sw.dev.v2.1.2.js'),
        to: path.join(__dirname, 'static/scripts/workbox.js')
      }
    ]))
    
    return config
  }
}
</code></pre></div>
<h2 dir="auto">Context</h2>


<p dir="auto">Can't copy files at build time.</p>
<h2 dir="auto">Your Environment</h2>

<table role="table">
<thead>
<tr>
<th>Tech</th>
<th>Version</th>
</tr>
</thead>
<tbody>
<tr>
<td>next</td>
<td>4.1.4</td>
</tr>
<tr>
<td>node</td>
<td>9.2.0</td>
</tr>
<tr>
<td>OS</td>
<td>OS X 10.11.6</td>
</tr>
<tr>
<td>browser</td>
<td>Chrome 62</td>
</tr>
<tr>
<td>etc</td>
<td></td>
</tr>
</tbody>
</table>
<ul class="contains-task-list">
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> I have searched the <a href="https://github.com/zeit/next.js/issues">issues</a> of this repository and believe that this is not a duplicate.</li>
</ul>
<h2 dir="auto">Expected Behavior</h2>
<p dir="auto">Using the new <a class="issue-link js-issue-link notranslate" rel="noopener noreferrer nofollow" href="https://linear.app/vercel/issue/NEXT-css">next-css</a> module in dev mode, I'd like to globally import a css stylesheet and figured out the correct place could be <code class="notranslate">_document.js</code>.</p>
<p dir="auto"><code class="notranslate">import '../css/style.css';</code></p>
<h2 dir="auto">Current Behavior</h2>
<p dir="auto">It looks like importing css works only in components or in pages.<br>
Production is unaffected by this problem as we're using a different strategy: <a href="https://github.com/zeit/next-plugins/tree/master/packages/next-css#production-usage">https://github.com/zeit/next-plugins/tree/master/packages/next-css#production-usage</a></p>
<h2 dir="auto">Your Environment</h2>
<table role="table">
<thead>
<tr>
<th>Tech</th>
<th>Version</th>
</tr>
</thead>
<tbody>
<tr>
<td>next</td>
<td>5.0</td>
</tr>
<tr>
<td>node</td>
<td>9.5</td>
</tr>
<tr>
<td>OS</td>
<td>MacOS</td>
</tr>
<tr>
<td>browser</td>
<td>Chrome</td>
</tr>
</tbody>
</table>