Skip to content
This repository was archived by the owner on Aug 28, 2026. It is now read-only.
This repository was archived by the owner on Aug 28, 2026. It is now read-only.

Leading _ in exported classname #541

Closed

Description

@Diokuz

bug

What is the current behavior?

:export {
  ._x { color: red }
}

transformed to object

exports.locals = {
	"x": "src⁄x___x"
};

If the current behavior is a bug, please provide the steps to reproduce.
just use [css-loader, postcss-loader] with this postcss.config.js:

const plugins = [
  require('postcss-modules-local-by-default'),
  require('postcss-modules-scope')(),
];

exports.plugins = plugins;

What is the expected behavior?
should be

exports.locals = {
	"_x": "src⁄x___x"
};

Please mention other relevant information such as your webpack version, Node.js version and Operating System.

node@7 webpack@2 [email protected]

Activity

  1. Diokuz commented on May 24, 2017

    @Diokuz
    Author

    Looks like you cannot take just prop here, because of this

  2. alexander-akait commented on May 24, 2017

    @alexander-akait
    Member

    @Diokuz interesting, _x is valid ident for css-modules, maybe we need question about this here https://github.com/css-modules/postcss-modules-values

  3. michael-ciniawsky commented on May 24, 2017

    @michael-ciniawsky
    Contributor

    You use postcss-modules-* plugins in postcss.config.js + postcss-loader ?

  4. michael-ciniawsky commented on May 24, 2017

    @michael-ciniawsky
    Contributor

    That could be a problem then, since css-loader implements CSSM via these plugins and if the source CSS is already transformed this might not work

  5. TrySound commented on May 24, 2017

    @TrySound
    Contributor

    @michael-ciniawsky We can fix that :)

  6. michael-ciniawsky commented on May 24, 2017

    @michael-ciniawsky
    Contributor

    @TrySound We should fix that 😛 once and for all, always problems 🐛 atm... :D

  7. michael-ciniawsky commented on May 24, 2017

    @michael-ciniawsky
    Contributor

    @Diokuz Does it work without the plugins in postcss.config.js ?

  8. alexander-akait commented on May 24, 2017

    @alexander-akait
    Member

    @TrySound Am i right what we should fix this in postcss-modules-values?

  9. Diokuz commented on May 24, 2017

    @Diokuz
    Author

    You use postcss-modules-* plugins in postcss-config.js + postcss-loader ?

    Yes, postcss-loader then css-loader

    @Diokuz Does it work without the plugin in postcss.config.js ?

    Without plugins it creates not what I need

    /***/ "./src/x.css":
    /***/ (function(module, exports, __webpack_require__) {
    
    exports = module.exports = __webpack_require__("./node_modules/css-loader/lib/css-base.js")(undefined);
    // imports
    
    
    // module
    exports.push([module.i, "._x {\n  color: red;\n}\n", ""]);
    
  10. alexander-akait commented on Feb 15, 2018

    @alexander-akait
    Member

    Done in #543

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Type

No type

Fields

Priority

None yet

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions