title: Can I use webpack imports-loader to require CSS files alongside certain JS dependencies? (or, how to implicitly load CSS)
body: <p>I'm trying to convert a large project using RequireJS to Webpack 4. The end goal is to be able to use both tools side by side, at least for development, with minimal changes to actual code required.</p>
  
  <p>I'm running into an issue with converting shim entries in my RequireJS config file to their Webpack equivalents when CSS is involved. For example, here's what a RequireJS config entry looks like:</p>
  
  <pre><code>shim: {
    jsDependency: {
      deps: ["otherJsDependency", "css!cssDependency"]
    }
  }
  </code></pre>
  
  <p>The Webpack recommended way to shim is by using imports-loader, so here's what I've tried there (inside <code>module.rules</code> array):</p>
  
  <pre><code>{
    test: /jsDependency/,
    use: ['imports-loader?otherJsDependency,cssDependency']
  }
  </code></pre>
  
  <p>The JS seems to resolve fine. I can't get the CSS to load this way. Other CSS files that are explicitly imported alongside the dependencies themselves load fine.</p>
  
  <p>I guess I can create a wrapper file that requires CSS and the original dependency explicitly side by side. It would be a bit of a pain but not too much work. We do have a lot of these entries in our RequireJS config.</p>
  
  <p>However... is there really no way to shim / load CSS implicitly like this with Webpack? Is imports-loader the wrong tool for the job here? I feel like I must be missing something.</p>
  
  <p>Thanks!</p>