SolidZORO / next-plugin-antd-less

🎩 Use Antd (Less) with Next.js v12, Zero Dependency on other Next-Plugins.
MIT License
345 stars 48 forks source link

TypeError: this.getOptions is not a function #20

Closed LikeCarter closed 3 years ago

LikeCarter commented 3 years ago

Getting this error on version 0.2.2. Works perfectly fine on 0.2.0. Seems that the upgraded less-loader is causing the issue?

error - ./node_modules/antd/lib/style/index.less ((webpack)/css-loader/cjs.js??ref--5-oneOf-3-1!(webpack)/postcss-loader/cjs.js??ref--5-oneOf-3-2!(webpack)/resolve-url-loader??ref--5-oneOf-3-3!./node_modules/less-loader/dist/cjs.js??ref--5-oneOf-3-4!./node_modules/antd/lib/style/index.less)
TypeError: this.getOptions is not a function
SolidZORO commented 3 years ago

less-loader config lessOptions has changed in 8.0.0

https://github.com/webpack-contrib/less-loader#lessoptions

// less-loader < 8.0.0
{
  loader: "less-loader",
  options: {
    strictMath: true,
  },
}
// less-loader > 8.0.0
{
  loader: "less-loader",
  options: {
    lessOptions: {         //  <-- add this key level.
      strictMath: true,
    },
  },
},
SolidZORO commented 3 years ago

@LikeCarter you can try install next-plugin-antd-less@^0.3.0 fixed.