Skip to content

Server side: generateScopedName is not used while using Babel #53

Open
@vojtatranta

Description

@vojtatranta

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions