akanix42/meteor-css-modules

Global styles missing with nathantreid:css-modules@4.0.0

Closed this issue · 5 comments

yched commented

As discussed in #124, v4.0.0 fixed issues with local styles compilation in v3.2.0 / Meteor 1.8.

However, v4.0.0 also seems to have lost processing of global SASS styles through the 'passthroughPaths' option

yched commented

Pushed a reproduction repo at https://github.com/yched/repro_meteor-css-modules_127

It actually seems this is in fact not related to SASS processing: all global styles, SASS or plain CSS, are missing.
Since our app uses global SASS styles, I left the SASS check in my repro code.

Thanks for providing the repo! The issue here is that the files are not being imported, so they are not included in the bundle.
Here is the updated client/main.jsx:

import React from 'react';
import { Meteor } from 'meteor/meteor';
import { render } from 'react-dom';
import '../styles/global.css';
import '../styles/global.scss';
import App from '/imports/ui/App';

Meteor.startup(() => {
  render(<App />, document.getElementById('react-target'));
});
yched commented

Thanks, I'll try that. Any idea why those styles were included without the need for an explicit import up until v1.3.4 ?

v3.2.0 was the first version to implement support for the mainModule syntax property in package.json, which was introduced in Meteor 1.7. Prior to v3.2.0, this package didn't properly detect that the files should be only be included if they were being imported unless the files were in an imports directory.

yched commented

Oh, right, makes perfect sense.
Thanks @nathanreid !