Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
4.5k views
in Technique[技术] by (71.8m points)

按需引入 antd 一用组件就报错 Possibly missing '(' in mixin call

image.png
image.png
node_modules 下的 antd 文件夹下的 .less文件的 mixin用法都加上括号就不报错了,但是我要每引入一个就加括号,这不太合理呀,我之前弄得也没有这个情况。
项目有 lesssass 两个预处理语言,我每引入一个组件就报几个错,这该怎么解决呀?

// less 版本
    "less": "^4.0.0",
    "less-loader": "7.2.1",

//// main.ts
import './styles/antdTheme.js'

// antdTheme.js
import Vue from "vue";
import {Button, message} from 'ant-design-vue'

[Button, message].forEach((item) => {
  Vue.use(item);
});

Vue.prototype.$message = message


// babel.config.js
module.exports = {
  presets: ["vca-jsx", "@vue/cli-plugin-babel/preset"],
  plugins: [
    [
      "import",
      { libraryName: "ant-design-vue", libraryDirectory: "es", style: true }
    ]
  ]
};

// vue.config.js
const modifyVars = require("./src/styles/antdTheme.js");

 css: {
    loaderOptions: {
      sass: {
        prependData: `
        @import '@/styles/variable.scss';
        @import '@/styles/mixins.scss';
        @import '@/styles/global.scss';
        `
      },
      less: {
        lessOptions: {
          javascriptEnabled: true,
          modifyVars
        }
      }
    }
  }

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
  1. less 版本降到 3.0 以下,less-loader 降到 5.0.0

    1. npm i --save-dev [email protected] [email protected]
    2. less3.0版本会报下面这个错,less4.0会报上面的错Possibly missing '(' in mixin call

      sadasd.png


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

1.4m articles

1.4m replys

5 comments

57.0k users

...