You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a library that contains all the styles for multiple component libraries. The component libraries have different ways of injecting the styles so I use the inject: false option of rollup-plugin-postcss, and let each library handle injection. In the styles library, I need to be able to export both the 1) js object of classNames, and 2) the raw css content so that the component libraries can use it.
The best way I have found to achieve that is this:
export { default as ButtonStyles, stylesheet as ButtonCSS } from './button.css'
As such, I need the stylesheet export because when using css modules, the default export is just the js object.
(Happy to go into more details on my use case, basically just trying to say enough to make it clear that I need the actual stylesheet export.)
Problem
The output generated when using the
stylesheet
export contains theconst
keyword, causing the code to break in some areas.Solution
Replace
const
withvar
on the following line:rollup-plugin-postcss/src/postcss-loader.js
Line 199 in b17c15d
Use Case
I have a library that contains all the styles for multiple component libraries. The component libraries have different ways of injecting the styles so I use the
inject: false
option ofrollup-plugin-postcss
, and let each library handle injection. In the styles library, I need to be able to export both the 1) js object of classNames, and 2) the raw css content so that the component libraries can use it.The best way I have found to achieve that is this:
As such, I need the
stylesheet
export because when using css modules, the default export is just the js object.(Happy to go into more details on my use case, basically just trying to say enough to make it clear that I need the actual
stylesheet
export.)Steps to Repro
Config:
rollup.config.js
Input:
src/index.js
src/index.css
Output:
dist/index.js
The text was updated successfully, but these errors were encountered: