Reputation: 1094
In React, in order to style a component, I simply import the style file that sits in the same directory as the component, e.g., import './style.scss'
. It's simple and easy, no problems there.
However, I can't seem to make this work in Preact. The style file just never get applied, even after following the docs and of course installing node-sass
and sass-loader
. I see plenty of examples out there using CSS modules and a few with CSS in JS, but I'd like to do a bog-standard import if possible.
Thanks in advance for any help you can provide.
Upvotes: 2
Views: 1306
Reputation: 1094
Apparently the solution was to disable CSS modules altogether by installing css-loader
and adding the following to my preact.config.js:
const css = helpers.getLoadersByName(config, 'css-loader')[0];
css.loader.options.modules = false;
Upvotes: 3