Giter Site home page Giter Site logo

antd-moment-webpack-plugin's Introduction

antd-moment-webpack-plugin

A webpack plugin to replace Day.js to Moment.js automatically.

Installation

npm install --save-dev @ant-design/moment-webpack-plugin

Usage

// webpack-config.js
import AntdMomentWebpackPlugin from '@ant-design/moment-webpack-plugin';

module.exports = {
  // ...
  plugins: [new AntdMomentWebpackPlugin()],
};

antd-moment-webpack-plugin's People

Contributors

afc163 avatar brunnerlivio avatar dengfuping avatar dong-xn avatar iamkun avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

antd-moment-webpack-plugin's Issues

Module not found: Error: Can't resolve 'dayjs/plugin/weekOfYear' in '/Users/jiajiaxing/Desktop/zhengan/sovell-mage-management-handlefraud-umi4/node_modules/@ant-design/pro-field/es/components/DatePicker'

umi3升级成umi4之后,顺便升级了antd5,配置兼容插件之后报错
// config/config.ts
chainWebpack(memo, args) {
memo.module
.rule('media')
.test(/.(mp3|4)$/)
.use('file-loader')
.loader(require.resolve('file-loader'));

memo.plugin('AntdMomentWebpackPlugin').use(new AntdMomentWebpackPlugin());

},

报错信息
./node_modules/@ant-design/pro-field/es/components/DatePicker/index.js:7:0-49
Module not found: Error: Can't resolve 'dayjs/plugin/weekOfYear' in '/Users/jiajiaxing/Desktop/zhengan/sovell-mage-management-handlefraud-umi4/node_modules/@ant-design/pro-field/es/components/DatePicker'
error - ./node_modules/@ant-design/pro-field/es/components/FromNow/index.js:6:0-53
error - ./node_modules/@ant-design/pro-field/es/index.js:45:0-57
error - ./node_modules/@ant-design/pro-field/es/index.js:46:0-43
error - ./node_modules/@ant-design/pro-field/es/index.js:47:0-49
error - ./node_modules/@ant-design/pro-field/es/index.js:48:0-43
error - ./node_modules/@ant-design/pro-field/es/index.js:49:0-49
error - ./node_modules/@ant-design/pro-utils/es/conversionMomentValue/index.js:3:0-55
error - ./node_modules/@ant-design/pro-utils/es/parseValueToMoment/index.js:2:0-63
Module not found: Error: Can't resolve 'dayjs/plugin/relativeTime' in '/Users/jiajiaxing/Desktop/zhengan/sovell-mage-management-handlefraud-umi4/node_modules/@ant-design/pro-field/es/components/FromNow'
Module not found: Error: Can't resolve 'dayjs/plugin/advancedFormat' in '/Users/jiajiaxing/Desktop/zhengan/sovell-mage-management-handlefraud-umi4/node_modules/@ant-design/pro-field/es'
Module not found: Error: Can't resolve 'dayjs/plugin/isoWeek' in '/Users/jiajiaxing/Desktop/zhengan/sovell-mage-management-handlefraud-umi4/node_modules/@ant-design/pro-field/es'
Module not found: Error: Can't resolve 'dayjs/plugin/localeData' in '/Users/jiajiaxing/Desktop/zhengan/sovell-mage-management-handlefraud-umi4/node_modules/@ant-design/pro-field/es'
Module not found: Error: Can't resolve 'dayjs/plugin/weekday' in '/Users/jiajiaxing/Desktop/zhengan/sovell-mage-management-handlefraud-umi4/node_modules/@ant-design/pro-field/es'
Module not found: Error: Can't resolve 'dayjs/plugin/weekOfYear' in '/Users/jiajiaxing/Desktop/zhengan/sovell-mage-management-handlefraud-umi4/node_modu

按照文档配置好了编译报错

UmiJS 4 项目,以下是配置信息以及错误信息:
配置:
chainWebpack(config) {
config.plugin('antd-moment')
.use(new AntdMomentWebpackPlugin())
}
报错:
error - ./node_modules/@ant-design/pro-field/es/components/DatePicker/index.js:10:0-49
Module not found: Error: Can't resolve 'dayjs/plugin/weekOfYear' in 'D:\project\vrmfront\node_modules@ant-design\pro-field\es\components\DatePicker'
error - ./node_modules/@ant-design/pro-field/es/components/FromNow/index.js:6:0-53
Module not found: Error: Can't resolve 'dayjs/plugin/relativeTime' in 'D:\project\vrmfront\node_modules@ant-design\pro-field\es\components\FromNow'
error - ./node_modules/@ant-design/pro-field/es/index.js:41:0-43
Module not found: Error: Can't resolve 'dayjs/plugin/weekday' in 'D:\project\vrmfront\node_modules@ant-design\pro-field\es'
error - ./node_modules/@ant-design/pro-field/es/index.js:42:0-49
Module not found: Error: Can't resolve 'dayjs/plugin/localeData' in 'D:\project\vrmfront\node_modules@ant-design\pro-field\es'
error - ./node_modules/@ant-design/pro-utils/es/conversionMomentValue/index.js:5:0-55
Module not found: Error: Can't resolve 'dayjs/plugin/quarterOfYear' in 'D:\project\vrmfront\node_modules@ant-design\pro-utils\es\conversionMomentValue'

Cannot read property 'resource' of undefined

getting below erroe after adding @ant-design/moment-webpack-plugin to webpackConfig file
Html Webpack Plugin:
Error: Child compilation failed:
Entry module not found: TypeError: Cannot read property 'resource' of undefined:
TypeError: Cannot read property 'resource' of undefined

  • compiler.js:141
    [duke-web-app]/[html-webpack-plugin]/lib/compiler.js:141:18

  • Compiler.js:343
    [duke-web-app]/[webpack]/lib/Compiler.js:343:11

  • Compiler.js:681
    [duke-web-app]/[webpack]/lib/Compiler.js:681:15

  • Hook.js:154 AsyncSeriesHook.lazyCompileHook
    [duke-web-app]/[tapable]/lib/Hook.js:154:20

  • Compiler.js:678
    [duke-web-app]/[webpack]/lib/Compiler.js:678:31

  • Hook.js:154 AsyncSeriesHook.lazyCompileHook
    [duke-web-app]/[tapable]/lib/Hook.js:154:20

  • Compilation.js:1423
    [duke-web-app]/[webpack]/lib/Compilation.js:1423:35

Can't install at all

Hi,

This plugin is unusable. I couldn't make it work, it make a different kind of error for every solution that I thought could have worked. That's really a shame ! :(

Seems like nothing changes

Hello!

Still getting error logs after plugin installed and added in webpack config

Can u please specify webpack/webpack-cli versions supported
Or may be some suggestions what can be wrong

Cannot compile project that uses @ant-design/pro-components

Steps to reproduce:

  1. Compile a project that uses ProList

webpack 5.75.0 compiled with 5 errors

ERROR in ./node_modules/@ant-design/pro-field/es/components/DatePicker/index.js 9:0-49 Module not found: Error: Can't resolve 'dayjs/plugin/weekOfYear'

ERROR in ./node_modules/@ant-design/pro-field/es/components/FromNow/index.js 7:0-53 Module not found: Error: Can't resolve 'dayjs/plugin/relativeTime'

ERROR in ./node_modules/@ant-design/pro-field/es/index.js 42:0-43 Module not found: Error: Can't resolve 'dayjs/plugin/weekday'

ERROR in ./node_modules/@ant-design/pro-field/es/index.js 43:0-49 Module not found: Error: Can't resolve 'dayjs/plugin/localeData'

ERROR in ./node_modules/@ant-design/pro-utils/es/conversionMomentValue/index.js 5:0-55 Module not found: Error: Can't resolve 'dayjs/plugin/quarterOfYear'

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.