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 353 B

123456789101112131415
  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. if (source.endsWith('.less')) {
  8. if (path.node.specifiers.length > 0) {
  9. path.node.source.value += '?modules';
  10. }
  11. }
  12. },
  13. },
  14. };
  15. }