question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Craco / Ant Design : Replacing Moment By Dayjs Configuration

See original GitHub issue

I’m trying to add a webpack plugin to Craco but I’m not sure if I’m doing it the right way. const CracoLessPlugin = require('craco-less') const AntdDayjsWebpackPlugin = require('antd-dayjs-webpack-plugin')

module.exports = {
	webpack: {
		plugins: [new AntdDayjsWebpackPlugin()],
	},
	plugins: [
		{
			plugin: CracoLessPlugin,
			options: {
				lessLoaderOptions: {
					lessOptions: {
						modifyVars: { '@primary-color': '#2a9d8f', '@text-color': '#264653' },
						javascriptEnabled: true,
					},
				},
			},
		},
	],
}

Any ideas on the correct config ? thx

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:8

github_iconTop GitHub Comments

3reactions
josdiagoncommented, Feb 16, 2022

As mentioned in https://github.com/ant-design/antd-dayjs-webpack-plugin/issues/45#issuecomment-1041424861

I experienced the same problem. Finally I get it to work like this:

const AntdDayjsWebpackPlugin = require("antd-dayjs-webpack-plugin");

module.exports = {
  webpack: {
    plugins: {
      add: [new AntdDayjsWebpackPlugin()],
    },
  },
};

For checking if it is working I am just doing:

console.log(dayjs.isDayjs(moment()));
1reaction
Thanaencommented, Nov 3, 2020

Here’s my setup for craco + antd + dayjs:

const CracoAntDesignPlugin = require('craco-antd');
const AntdDayjsWebpackPlugin = require('antd-dayjs-webpack-plugin');

module.exports = {
  plugins: [
    {
      plugin: CracoAntDesignPlugin,
    },
    {
      plugin: new AntdDayjsWebpackPlugin(),
    },
  ],
};
Read more comments on GitHub >

github_iconTop Results From Across the Web

Craco / Ant Design : Replacing Moment By Dayjs ... - GitHub
I'm trying to add a webpack plugin to Craco but I'm not sure if I'm doing it the right way. const CracoLessPlugin =...
Read more >
Craco / Ant Design : Replacing Moment By Dayjs Configuration
I'm trying to add a webpack plugin to Craco but I'm not sure if I'm doing it the right way. const CracoLessPlugin =...
Read more >
Use custom date library - Ant Design
By default, Ant Design use Day.js to handle time and date. Day.js is an immutable date-time library alternative to Moment.js with the same...
Read more >
antd replace moment with dayjs - Stack Overflow
since moment is no longer maintained, I am replacing it with dayjs on ant design. The issue comes when using the datepicker, it...
Read more >
antd-dayjs-webpack-plugin - npm
Day.js webpack plugin for Ant Design (antd). Latest version: 1.0.6, last published: 2 years ago. Start using antd-dayjs-webpack-plugin in ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found