You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

babel-plugin-auto-css-modules.js 392 B

12345678910111213141516
  1. export default function(babel) {
  2. const { types: t } = babel;
  3. return {
  4. visitor: {
  5. ImportDeclaration(path) {
  6. const source = path.node.source.value;
  7. // console.log("zzzz", source);
  8. if (source.endsWith('.less')) {
  9. if (path.node.specifiers.length > 0) {
  10. path.node.source.value += "?modules";
  11. }
  12. }
  13. },
  14. },
  15. };
  16. };