egoist / egoist/rollup-plugin-postcss

Impossible to inject CSS from a node_modules import

Open
#379 7 comments 5 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
689
Forks
210
PR merge metrics
No merged PRs in 30d

Description

So here is my rollup config

```
// tsdx.config.js
const postcss = require('rollup-plugin-postcss');
const autoprefixer = require('autoprefixer');
const cssnano = require('cssnano');
const tailwindcss = require('tailwindcss');

module.exports = {
rollup(config, _options) {
config.plugins.push(
postcss({
plugins: [
autoprefixer(),
tailwindcss(),
cssnano({
preset: 'default',
}),
],
extensions: ['.css'],
modules: {
scopeBehaviour: 'global',
globalModulePaths: [
/react-toastify/,
],
},
inject: true,
extract: false,
}),
);
return config;
},
};
```

So if I import css file local from a relative path, it gets injected but I import from node_modules it doesn't

```
import React from 'react';
import { toast } from 'react-toastify';
import 'react-toastify/dist/ReactToastify.css';
// The following works if I copy the file locally
// import './ReactToastify.css';
```

What am I doing wrong here?

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.