babel-plugin-react-css-modules icon indicating copy to clipboard operation
babel-plugin-react-css-modules copied to clipboard

Better error messages

Open Psykar opened this issue 9 years ago • 3 comments

https://github.com/gajus/babel-plugin-react-css-modules/blob/f3ccba1d182a465fe81bba9f1217ccc5e0ac08df/src/getClassName.js#L25

Should put the name that fails here, otherwise you have to check each styleName manually.

Psykar avatar Mar 06 '17 03:03 Psykar

Maybe not required - these are very early import messages, not after the file is parsed, and in my case were due to screwing up my config ( #58 ) Might still be useful - but if you disagree and close, I won't be fussed :)

Psykar avatar Mar 06 '17 04:03 Psykar

Yes, that would be really helpful. It would be much easier to find missing class

mzvonar avatar Jun 28 '17 15:06 mzvonar

https://github.com/gajus/babel-plugin-react-css-modules/blob/f3ccba1d182a465fe81bba9f1217ccc5e0ac08df/src/index.js#L109-L111

here we can add

if (stats.opts.debug) { // provide a new option debug
  console.log(`at ${filename} import:`);
  console.log(targetResourcePath);
  console.log(`the resource link we use is: ${path.node.source.value}`);
}

https://github.com/gajus/babel-plugin-react-css-modules/blob/f3ccba1d182a465fe81bba9f1217ccc5e0ac08df/src/index.js#L134-L136

and here we can add:

if (stats.opts.debug) {
  console.log(`after process the import the filenameMap[${filename}].styleModuleImportMap is:  ` + JSON.stringify(filenameMap[filename].styleModuleImportMap) + '\n');
}

NE-SmallTown avatar Sep 09 '17 07:09 NE-SmallTown