akanix42 / meteor-css-modules

MIT License
92 stars 20 forks source link

Can't get SSR to work: "modules.addStyles is not a function" #99

Closed neoromantic closed 7 years ago

neoromantic commented 7 years ago

So, there was an issue just like I have now: https://github.com/nathantreid/meteor-css-modules/issues/13

I get this error:

W20170421-20:38:46.017(4)? (STDERR) /Users/sergey.petrov/.meteor/packages/meteor-tool/.1.4.4_1.akhpt4++os.osx.x86_64+web.browser+web.cordova/mt-os.osx.x86_64/dev_bundle/server-lib/node_modules/fibers/future.js:280
W20170421-20:38:46.017(4)? (STDERR)                         throw(ex);
W20170421-20:38:46.017(4)? (STDERR)                         ^
W20170421-20:38:46.017(4)? (STDERR) 
W20170421-20:38:46.018(4)? (STDERR) TypeError: modules.addStyles is not a function
W20170421-20:38:46.018(4)? (STDERR)     at meteorInstall.imports.ui.pages.NotFoundPage.NotFoundPage.scss.js (/Users/sergey.petrov/Projects/giveback/app/.meteor/local/build/programs/server/app/app.js:4081:9)
W20170421-20:38:46.018(4)? (STDERR)     at fileEvaluate (packages/modules-runtime.js:197:9)
W20170421-20:38:46.019(4)? (STDERR)     at require (packages/modules-runtime.js:120:16)
W20170421-20:38:46.019(4)? (STDERR)     at meteorInstall.imports.ui.pages.NotFoundPage.NotFoundPage.scss (/Users/sergey.petrov/Projects/giveback/app/.meteor/local/build/programs/server/app/app.js:4055:18)
W20170421-20:38:46.019(4)? (STDERR)     at fileEvaluate (packages/modules-runtime.js:197:9)
W20170421-20:38:46.019(4)? (STDERR)     at Module.require (packages/modules-runtime.js:120:16)
W20170421-20:38:46.020(4)? (STDERR)     at Module.Mp.importSync (/Users/sergey.petrov/.meteor/packages/modules/.0.8.2.1x8q6dh++os+web.browser+web.cordova/npm/node_modules/reify/lib/runtime.js:82:24)
W20170421-20:38:46.020(4)? (STDERR)     at meteorInstall.imports.ui.pages.NotFoundPage.NotFoundPage.jsx (imports/ui/pages/NotFoundPage/NotFoundPage.jsx:1:19)
W20170421-20:38:46.020(4)? (STDERR)     at fileEvaluate (packages/modules-runtime.js:197:9)
W20170421-20:38:46.020(4)? (STDERR)     at Module.require (packages/modules-runtime.js:120:16)

My package.json looks like:


 "dependencies": {
    "babel-runtime": "^6.23.0",
    "bcrypt": "^1.0.2",
    "classnames": "^2.2.5",
    "faker": "^4.1.0",
    "lodash": "^4.17.4",
    "message-box": "0.0.2",
    "meteor-node-stubs": "~0.2.4",
    "mobx": "^3.1.9",
    "mobx-react": "^4.1.8",
    "moment": "^2.18.1",
    "moment-timezone": "^0.5.11",
    "prop-types": "^15.5.7",
    "react": "^15.5.3",
    "react-contenteditable": "^2.0.2",
    "react-dom": "^15.5.4",
    "react-helmet": "^5.0.2",
    "react-komposer": "^2.0.0",
    "react-markdown": "^2.4.6",
    "react-moment": "^0.2.2",
    "react-router-dom": "^4.0.0",
    "react-tap-event-plugin": "^2.0.1",
    "react-toolbox": "^2.0.0-beta.8",
    "react-transition-group": "^1.1.1",
    "recompact": "^2.2.4",
    "rollbar": "^0.6.3",
    "simpl-schema": "^0.2.3",
    "twix": "^1.1.4",
    "uniforms": "^1.16.0"
  },
  "devDependencies": {
    "babel-eslint": "^7.1.1",
    "babel-plugin-transform-class-properties": "^6.23.0",
    "babel-plugin-transform-decorators-legacy": "^1.3.4",
    "babel-preset-es2015": "^6.9.0",
    "babel-preset-es2016": "^6.11.3",
    "babel-preset-meteor": "^6.23.1",
    "babel-preset-react": "^6.11.1",
    "babel-preset-stage-0": "^6.22.0",
    "babel-preset-stage-1": "^6.13.0",
    "babel-root-slash-import": "^1.1.0",
    "eslint": "^3.17.1",
    "eslint-config-airbnb": "^14.1.0",
    "eslint-import-resolver-meteor": "^0.4.0",
    "eslint-plugin-import": "^2.2.0",
    "eslint-plugin-jsx-a11y": "^4.0.0",
    "eslint-plugin-react": "^6.10.0",
    "mocha": "^3.2.0",
    "node-sass": "^4.0.0",
    "postcss-cssnext": "^2.9.0",
    "postcss-each": "^0.9.3",
    "postcss-import": "^9.1.0",
    "postcss-mixins": "^5.4.1",
    "postcss-modules-extract-imports": "^1.0.1",
    "postcss-modules-local-by-default": "^1.1.1",
    "postcss-modules-scope": "^1.0.2",
    "postcss-simple-vars": "^3.0.0",
    "sass-lint": "^1.10.2",
    "@kadira/storybook": "^2.21.0"
  },
  "babel": {
    "plugins": [
      "transform-class-properties"
    ]
  },
  "cssModules": {
    "specificArchitecture": false,
    "postcssPlugins": {
      "postcss-import": {},
      "postcss-mixins": {},
      "postcss-each": {},
      "postcss-cssnext": {},
      "postcss-modules-local-by-default": {},
      "postcss-modules-extract-imports": {},
      "postcss-modules-scope": {},
      "postcss-simple-vars": {
        "fileOptions": [
          "style-globals.json"
        ]
      }
    },
    "ignorePaths": [
      "node_modules/(?!react-toolbox/lib)"
    ],
    "extensions": [
      "scss",
      "css"
    ],
    "globalVariables": [
      "style-globals.json"
    ]
  }```

Any ideas? 
akanix42 commented 7 years ago

I'm looking into this. From what I recall the error is caused when a build plugin tries to add a stylesheet when you're building on the server platform (instead of the web platform). However, I have specific checks in place for that...

akanix42 commented 7 years ago

This was fixed in the 2.5.4 release.