title: how to properly bundle and import css with rollup react - Global CSS cannot be imported from within node_modules
body: <p>I have a react app (next.js) and a react component library.</p>
  <p>In my library, I have a couple css module imports from 3rd party libraries (i.e. tailwind and fontsource) which are causing issues in my next.js app when I import my lib.</p>
  <blockquote>
  <p>error - ./node_modules/tailwindcss/tailwind.css Global CSS cannot be
  imported from within node_modules. Read more:
  <a href="https://nextjs.org/docs/messages/css-npm" rel="nofollow noreferrer">https://nextjs.org/docs/messages/css-npm</a></p>
  </blockquote>
  <p><strong>output-filename.cjs.development.js</strong></p>
  <pre><code>'use strict';
  
  Object.defineProperty(exports, '__esModule', { value: true });
  
  function _interopDefault (ex) { return (ex &amp;&amp; (typeof ex === 'object') &amp;&amp; 'default' in ex) ? ex['default'] : ex; }
  
  var React = require('react');
  var React__default = _interopDefault(React);
  require('tailwindcss/tailwind.css'); // &lt;&lt; next.js complains
  require('@fontsource/titillium-web/index.css'); // &lt;&lt; next.js complains
  ...
  </code></pre>
  <p>Is there a way to configure rollup to build these as local css files i can include in the build, and if so, how do I import them in the react library code? I have tried adding extract: true to postcss config but it doesn't seem to generate everything properly (all the styles are missing in the .css file) and I'm not sure how to import them.</p>
  <p><strong>rollup config (via tsdx.config.js)</strong></p>
  <pre><code>const postcss = require('rollup-plugin-postcss')
  module.exports = {
    rollup(config, options) {
      config.plugins.push(
        postcss({
          config: {
            path: './postcss.config.js'
          },
          extensions: ['.css'],
          minimize: true,
          inject: {
            insertAt: 'top'
          },
          extract: true
        })
      )
      return config
    }
  }
  </code></pre>