Skip to content

Can't get CSS Modules to work on Meteor 1.6 (still) #106

Open
@neoromantic

Description

@neoromantic

I've been using this package for awhile now, along with meteor 1.4, 1.5 and now I'm trying to get it working with 1.6. Also, I use react-toolbox.

Currently, I just get unstyled components, as if no import styles from 'file.css' were working. No errors, I even see 'processing files with nathantreid:meteor-css-modules' line when run devserver. But no css code gets to client.

I suppose my configuration is a bit wrong, could anyone point me to an error?

Here's my setup:

.meteor/packages

  1 # Meteor packages used by this project, one per line.                                                                                                       
  2 
  3 [email protected]             # Packages every Meteor app needs to have
  4 [email protected]       # Packages for a great mobile UX
  5 [email protected]                   # The database Meteor supports right now
  6 [email protected]            # Reactive variable for tracker
  7 [email protected]                 # Meteor's client-side reactive programming library
  8 
  9 [email protected]    # JS minifier run for production mode
 10 [email protected]                # ECMAScript 5 compatibility for older browsers.
 11 [email protected]              # Enable ECMAScript2015+ syntax in app code
 12 [email protected]            # Server-side component of the `meteor shell` command
 13 
 14 static-html
 15 aldeed:[email protected]
 16 aldeed:schema-index
 17 matb33:collection-hooks
 18 reywood:publish-composite
 19 universe:i18n
 20 [email protected]
 21 
 22 nathantreid:[email protected]
 23 [email protected]
 24 dburles:collection-helpers
 25 alanning:roles
 26 dburles:factory
 27 aldeed:schema-deny
 28 [email protected]
 29 tmeasday:publish-counts
 30 [email protected]
 31 mdg:validated-method
 32 tunifight:loggedin-mixin
 33 [email protected]
 34 [email protected]
 35 rlivingston:simple-schema-mixin
 36 percolate:migrations
 37 gwendall:impersonate
 38 ziarno:restrict-mixin
 39 [email protected]

package.json

{
  "dependencies": {
    "anchorate": "^1.1.0",
    "babel-runtime": "^6.26.0",
    "bcrypt": "^1.0.3",
    "caniuse-db": "^1.0.30000746",
    "classnames": "^2.2.5",
    "deep-extend": "^0.5.0",
    "faker": "^4.1.0",
    "file-saver": "^1.3.3",
    "filestack-react": "^1.3.8",
    "lodash": "^4.17.4",
    "message-box": "0.1.1",
    "meteor-node-stubs": "~0.3.2",
    "meteor-subdomain-persistent-login-fixed": "^1.0.1",
    "mobx": "^3.3.1",
    "mobx-logger": "^0.6.0",
    "mobx-react": "^4.3.3",
    "mobx-task": "^0.2.3",
    "moment": "^2.19.1",
    "moment-timezone": "^0.5.13",
    "postcss-responsive-type": "^1.0.0",
    "prop-types": "^15.6.0",
    "react": "^16.0.0",
    "react-dom": "^16.0.0",
    "react-emoji-render": "^0.4.2",
    "react-helmet": "^5.2.0",
    "react-loadable": "^5.2.2",
    "react-markdown": "^2.5.0",
    "react-moment": "^0.6.5",
    "react-required-if": "^1.0.1",
    "react-router-dom": "^4.2.2",
    "react-tap-event-plugin": "^3.0.2",
    "react-toastify": "^2.1.2",
    "react-toolbox": "^2.0.0-beta.12",
    "react-transition-group": "^2.2.1",
    "recompact": "^3",
    "rollbar": "^2.2.9",
    "simpl-schema": "^0.3.2",
    "slugify": "^1.2.1",
    "uniforms": "^1.22.0-rc.1"
  },
  "devDependencies": {
    "babel-eslint": "^8.0.1",
    "babel-plugin-transform-class-properties": "^6.24.1",
    "babel-plugin-transform-decorators-legacy": "^1.3.4",
    "babel-preset-env": "^1.6.0",
    "babel-preset-meteor": "^6.26.1",
    "babel-preset-react": "^6.24.1",
    "babel-preset-stage-0": "^6.24.1",
    "babel-preset-stage-1": "^6.24.1",
    "babel-root-slash-import": "^1.1.0",
    "eslint": "^4.8.0",
    "eslint-config-airbnb": "^16.0.0",
    "eslint-import-resolver-meteor": "^0.4.0",
    "eslint-plugin-import": "^2.7.0",
    "eslint-plugin-jsx-a11y": "^6.0.2",
    "eslint-plugin-react": "^7.4.0",
    "mocha": "^4.0.1",
    "node-sass": "^4.5.3",
    "postcss-cssnext": "2.11.0",
    "postcss-each": "^0.10.0",
    "postcss-import": "^11.0.0",
    "postcss-mixins": "^6.1.1",
    "postcss-modules-extract-imports": "^1.1.0",
    "postcss-modules-local-by-default": "^1.2.0",
    "postcss-modules-scope": "^1.1.0",
    "postcss-modules-values": "^1.3.0",
    "postcss-simple-vars": "^4.1.0",
    "sass-lint": "^1.12.0"
  },
  "babel": {
    "plugins": ["transform-class-properties"]
  },
  "cssModules": {
    "postcssPlugins": {
      "postcss-import": {},
      "postcss-mixins": {},
      "postcss-each": {},
      "postcss-cssnext": {},
      "postcss-responsive-type": {},
      "postcss-modules-local-by-default": {},
      "postcss-modules-extract-imports": {},
      "postcss-modules-scope": {},
      "postcss-simple-vars": {
        "fileOptions": ["style-globals.json"]
      }
    },
    "extensions": ["scss", "css"],
    "globalVariables": ["style-globals.json"]
  }
}

.babelrc:

{
  "presets": [["env", { "targets": { "node": "current" } }], "react", "stage-2"],
  "plugins": ["babel-root-slash-import", "transform-decorators-legacy", "transform-class-properties"]
}

I use styles like that:

import styles from './somemodule.scss'

const ReactModule = () => <div className={styles.test} />

@nathantreid if you could help soon, it would get me out of deep shithole, since I just can't release my project after Meteor 1.6 came around (old version doesn't builds in my CI process, i have to upgrade to 1.6 as it seems)

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions