If you use babel imports you have something like this:
import cssModulesRequireHook from 'css-modules-require-hook'
import cssnext from 'postcss-cssnext'
cssModulesRequireHook({
generateScopedName: '[name]__[local]___[hash:base64:5]',
prepend: [
cssnext(),
],
});
import App from './components/app.js'
And you app.js imports some css.
When you use babel-node all the imports go up in the code therefore cssModulesRequireHook() is called after requiring of app.js resulting into omitting generateScopedName.
Solution: return hook as function to be called with options, just like node-jsx.