Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

next-plugin-component-less

SolidZORO7MIT0.0.2

Use Antd (with Less) with Next.js, Zero Dependency on other Next-Plugins.

next, nextjs, next.js, less, less plugin, antd, ant design, antd plugin, plugin, css module, next plugin

readme

Next.js + Custom component library (with Less)

Support custom component library (Less) with Next.js v12,folked from next-plugin-antd-less v1.8.0

Installation

yarn add next-plugin-component-less
yarn add --dev babel-plugin-import

Features

  • New Parameter STYLE_REGX Support Custom Component Library With Less

Usage

for [Next.js]

// next.config.js
const withAntdLess = require('next-plugin-component-less');

module.exports = withAntdLess({
  STYLE_REGX: /(antd\/.*?\/style|@ant-design|@custom-fe\/.*?).*(?<![.]js)$/, // new parameter
  modifyVars: { '@primary-color': '#04f' }, // optional
});

Add a .babelrc.js

// .babelrc.js
module.exports = {
  presets: [['next/babel']],
  plugins: [[
      "import",
      {
        "libraryName": "antd",
        "style": true
      },
      "antd"
    ],
    [
      "import",
      {
        "libraryName": "@custom-fe/component",
        "libraryDirectory": "lib",
        "style": true,
        "camel2DashComponentName": false
      },
      "custom-fe-component"
    ]],
};

Detailed config can be found in next.config.js file.

changelog

Changelog

All notable changes to this project will be documented in this file. See standard-version for commit guidelines.

0.0.2 (2022-12-07)

Features

Bug Fixes

  • cannot set property '.less' of undefined (42ba69a)
  • cannot set property '.less' of undefined (8b178ac)
  • compatible with custom getLocalIdent in Next.js 12 (a20649e)
  • downgrade less-loader version to ^7.0 (TypeError: this.getOptions is not a function) (84df302), closes #30
  • downgrading less-loader to ^7, support CRA (^10 minimun wp5) (2d65318)
  • downgrading to less-loader 7.3.0 resolved issue (5cc2f20), closes #17
  • fixed config localIdentName (82fd24e)
  • fixed localIdentName (2f4159e)
  • fixed nest.js style lose (92fa666)
  • fixed not options lessVarsFilePath has error (686327c)
  • fixed pluginOptions.modifyVars to be optional (5e941f0), closes #42
  • keep css modules auto (c4a129b)
  • Make lessVarsFilePathAppendToEndOfContent not to include twice (138e0c3)
  • remove background-image, compatible CRA and Next.js (另外还有写在注释里的碎碎念) (60c10de)
  • remove the optional chain, for compatible deployment to vercel (e8b31f4)
  • unintended overwriting of sass module rule (deffefe)

Performance

  • use clone instend of lodash.clone (e6443fa)

Refactor

  • clear console.log (68d267e)
  • clear variable names (590f116)
  • close debug console.log (3b034e5)
  • config.module.rules INDEX compatible w/ webpack 4 and 5 (d73be86)
  • less in dependencies (b92122e)
  • remove all optional chaining, compatibility vercel deploy (9c6886c)
  • sharper nextConfig code (dc18381)
  • split overrideWebpackConfig (aded75c)
  • update less-loader to 8.0 (a48cb89)
  • use RULES_INDEX, more clearly code comment (bae11d5)

Chore

1.8.0 (2022-01-09)

Features

  • add nextjs.localIdentNameFollowDev config (2bfcad8)

1.7.0 (2021-12-23)

Features

1.6.0 (2021-12-10)

Features

  • for Unify getLocalIdent (Next.js / CRA) (615e95d)

1.5.2 (2021-11-01)

Bug Fixes

  • remove the optional chain, for compatible deployment to vercel (e8b31f4)

1.5.1 (2021-11-01)

1.5.0 (2021-11-01)

Bug Fixes

  • compatible with custom getLocalIdent in Next.js 12 (a20649e)

1.4.4 (2021-10-19)

Chore

  • upgrade Less to 4.1.2 thanks @nring

1.4.3 (2021-09-16)

Features

1.4.2 (2021-08-23)

Bug Fixes

  • remove background-image, compatible CRA and Next.js (另外还有写在注释里的碎碎念) (60c10de)

1.4.1 (2021-08-23)

Bug Fixes

  • downgrading less-loader to ^7, support CRA (^10 minimun wp5) (2d65318)

1.4.0 (2021-08-22)

Features

  • add echoIsServerInfo() Fn for Debug (9daff7c)
  • next-image-loader supported *.less (1860ea2), closes #59 #39
  • support *.svg with babel-plugin-inline-react-svg (daec84b), closes #72
  • update less-loader to v10 (9e495ae)

Chore

1.3.0 (2021-06-16)

Features

Chore

1.2.2 (2021-06-03)

Features

  • support serverless mode (d187df8)

1.2.1 (2021-05-15)

Features

  • file-loader supported *.less, e.g. background-image: url('img.jpg') (99011d4), closes #39

1.2.0 (2021-05-09)

Chore

  • format code by prettier config (e300a14)

1.1.4 (2021-04-29)

Bug Fixes

  • Make lessVarsFilePathAppendToEndOfContent not to include twice (138e0c3)

1.1.3 (2021-04-28)

Features

  • add options lessVarsFilePathAppendToEndOfContent (f42bbe2), closes #40

1.1.2 (2021-04-25)

Bug Fixes

  • downgrade less-loader version to ^7.0 (TypeError: this.getOptions is not a function) (84df302), closes #30

1.1.1 (2021-04-25)

1.1.0 (2021-04-25)

Refactor

  • update less-loader to 8.0 (a48cb89)

1.0.10 (2021-04-25)

Refactor

1.0.9 (2021-04-25)

Bug Fixes

  • cannot set property '.less' of undefined (42ba69a)
  • cannot set property '.less' of undefined (8b178ac)
  • fixed pluginOptions.modifyVars to be optional (5e941f0), closes #42

1.0.8 (2021-04-09)

Refactor

  • close debug console.log (3b034e5)

1.0.7 (2021-04-09)

Bug Fixes

  • fixed config localIdentName (82fd24e)

1.0.6 (2021-04-07)

Bug Fixes

  • fixed not options lessVarsFilePath has error (686327c)

1.0.5 (2021-04-05)

Refactor

  • remove all optional chaining, compatibility vercel deploy (9c6886c)

1.0.4 (2021-04-05)

Bug Fixes

  • fixed nest.js style lose (92fa666)

1.0.3 (2021-04-05)

Bug Fixes

1.0.2 (2021-04-04)

Chore

  • remove deps less-vars-to-js (c605968)

1.0.1 (2021-04-04)

1.0.0 (2021-04-04)

Features

  • supports both Next.js and CRA-Co (418ec5c)

Chore

Refactor

  • clear variable names (590f116)
  • split overrideWebpackConfig (aded75c)

0.3.0 (2021-02-07)

Bug Fixes

  • downgrading to less-loader 7.3.0 resolved issue (5cc2f20), closes #17

0.2.2 (2021-02-02)

Refactor

  • config.module.rules INDEX compatible w/ webpack 4 and 5 (d73be86)
  • use RULES_INDEX, more clearly code comment (bae11d5)

0.2.1 (2021-02-02)

Chore

0.2.0 (2021-02-01)

Refactor

0.1.4 (2021-01-26)

0.1.3 (2020-11-25)

Bug Fixes

0.1.2 (2020-11-25)

Features

0.1.1 (2020-11-25)

0.1.0 (2020-11-25)

Features

0.0.6 (2020-08-27)

0.0.5 (2020-08-27)

Bug Fixes

  • unintended overwriting of sass module rule (deffefe)

0.0.4 (2020-08-05)

Performance Improvements

  • use clone instend of lodash.clone (e6443fa)

0.0.3 (2020-08-05)

0.0.2 (2020-08-05)

Features

  • handle less file with antd (5bdf1c3)