I am attempting to configure a Rollup plugin to inject imported CSS from JSX/TSX files into the final bundle, but it's not working as expected. I'm unsure if this is due to a bug, a configuration issue, or a misunderstanding of the plugin's functionality.
In short, I'm building an Electron app and using Rollup to bundle its various components: the main, preload, and renderer processes.
Each component has its own Rollup configuration, generating a bundle that is output to the respective dist/{component} directory.
For the renderer component, which runs inside the Electron Browser, I am using React. I import CSS into my renderer/index.tsx file like this:
import * as React from "react";
import "./index.css";
Below is my Rollup configuration for the renderer process:
I expect the CSS to be embedded within the JavaScript bundle, but that isn't happening. I have tried reordering the plugins but continue to encounter the same issue.
If I change the mode to "extract" the outputed css in dist/renderer/SomeGeneratedName.css contains the actual css which has been imported within the react component.
Description
I am attempting to configure a Rollup plugin to inject imported CSS from JSX/TSX files into the final bundle, but it's not working as expected. I'm unsure if this is due to a bug, a configuration issue, or a misunderstanding of the plugin's functionality.
In short, I'm building an Electron app and using Rollup to bundle its various components: the
main
,preload
, andrenderer
processes.Each component has its own Rollup configuration, generating a bundle that is output to the respective
dist/{component}
directory.For the renderer component, which runs inside the Electron Browser, I am using React. I import CSS into my
renderer/index.tsx
file like this:Below is my Rollup configuration for the renderer process:
Expected Outcome
I expect the CSS to be embedded within the JavaScript bundle, but that isn't happening. I have tried reordering the plugins but continue to encounter the same issue.
If I change the mode to "extract" the outputed css in dist/renderer/SomeGeneratedName.css contains the actual css which has been imported within the react component.
Additional details