Antd 2.0 released in English - the best React components library šŸ‘

Iā€™ve been thinking of trying antd but is it really ready for a production environment?

Iā€™ve been using bootstrap, which everyone would agree is now quite mature, however react-bootstrap has still not yet reached 1.0.0. How does antd compare in maturity to react-bootstrap?

Iā€™ve had a look in particular at antdā€™s carousel component and it doesnā€™t seem to have any left and right controls, which makes me feel more reluctant to try it.

I create an issue on meteor-babel repo related this babel-plugin-import error:
https://github.com/meteor/babel/issues/13

I found that if you use meteor --production to run the code, the import error message is gone.
It seems reify module is needed by meteor to support import syntax in meteor shell (repl), but not used to compile production bundle.

This is the one component I had some trouble with. Otherwise Iā€™m loving not having to cobble together a bunch of third-party packages. react-boostrap forces you to npm for half your appā€¦ praying that XYZ component will work with the existing app, hoping it wont turn to abandoneware, etc.

Antd gives you 80% of what you need for most apps and you know theyā€™ll all play relatively nicely together. I donā€™t think Iā€™ll ever go back to react-bootstrap. The only downside is searching issues can kind of suck with google translate.

2 Likes

I see the problem with a fresh install of meteor.
Thanks to @ucokfm, I see that the ecmascript package is the problem (@0.6.3).

Downgrade the package to @0.6.1 fix the problem and antd works.

I posted an issue on the babel-plugin-import repo : https://github.com/ant-design/babel-plugin-import/issues/117

But I donā€™t know if itā€™s a problem with the meteor package or with the babel plugin.

I found this but it looks out of date:

https://www.npmjs.com/package/babel-plugin-antd-meteor

Is there anyway to test/confirm that you truly arenā€™t downloading the entire antd library and only using the needed ones?

1 Like

Hi guys,

Iā€™m trying to use CSS Modules (nathantreid:css-modules 2.4.0) along side ant-design. When trying to run the app it gets stuck at ā€˜Processing fields with nathantried:cssā€¦ā€™ Any thoughts?

Here is my package.json

{
  "name": "fulbacho",
  "private": true,
  "scripts": {
    "start": "meteor run",
    "lint": "eslint .",
    "pretest": "npm run lint --silent"
  },
  "dependencies": {
    "antd": "^2.6.0",
    "babel-runtime": "^6.20.0",
    "bcrypt": "^0.8.7",
    "classnames": "^2.2.5",
    "immutability-helper": "^2.0.0",
    "less": "^2.7.2",
    "meteor-node-stubs": "^0.2.3",
    "moment": "^2.17.0",
    "normalize.css": "^4.1.1",
    "react": "^15.3.2",
    "react-addons-css-transition-group": "^15.3.2",
    "react-addons-pure-render-mixin": "^15.3.2",
    "react-dom": "^15.3.2",
    "react-mounter": "^1.2.0",
    "react-redux": "^5.0.2",
    "react-router": "^3.0.1",
    "react-spinjs": "^3.0.0",
    "react-tap-event-plugin": "^2.0.1",
    "react-toolbox": "^1.3.4",
    "react-waypoint": "^4.1.0",
    "redux": "^3.6.0",
    "redux-logger": "^2.7.4",
    "redux-thunk": "^2.2.0",
    "underscore": "^1.8.3"
  },
  "eslintConfig": {
    "plugins": [
      "meteor"
    ],
    "extends": [
      "airbnb",
      "plugin:meteor/recommended"
    ],
    "rules": {
      "max-len": 0,
      "import/no-unresolved": 0,
      "no-underscore-dangle": [
        "error",
        {
          "allow": [
            "_id",
            "_ensureIndex",
            "_verifyEmailToken",
            "_resetPasswordToken",
            "_name"
          ]
        }
      ]
    }
  },
  "devDependencies": {
    "autoprefixer": "^6.3.5",
    "babel-eslint": "^7.0.0",
    "babel-plugin-import": "^1.1.0",
    "babel-preset-stage-1": "^6.16.0",
    "deep-freeze": "0.0.1",
    "eslint": "^2.10.2",
    "eslint-config-airbnb": "^9.0.1",
    "eslint-plugin-import": "^1.8.0",
    "eslint-plugin-jsx-a11y": "^1.2.0",
    "eslint-plugin-meteor": "^3.5.2",
    "eslint-plugin-react": "^5.1.1",
    "expect": "^1.20.2",
    "node-sass": "^3.4.2",
    "postcss-reporter": "^1.3.3",
    "redux-devtools": "^3.3.2",
    "redux-devtools-dock-monitor": "^1.1.1",
    "redux-devtools-log-monitor": "^1.2.0",
    "stylelint": "^5.2.1"
  },
  "postcss": {
    "plugins": {
      "autoprefixer": {},
      "stylelint": {
        "rules": {
          "selector-class-pattern": "[a-z]+"
        }
      },
      "postcss-reporter": {
        "clearMessages": true
      }
    }
  },
  "cssModules": {
    "extensions": [
      "scss",
      "less",
      "css"
    ],
    "enableSassCompilation": ["scss"],
    "enableLessCompilation": ["less"],
    "passthroughPaths": [
      "node_modules/antd"
    ],
    "globalVariables": [],
    "ignorePaths": [
      "node_modules/node-sass/test",
      "node_modules/doiuse/test",
      "node_modules/css-tokenize/test",
      "node_modules/convert-source-map/test",
      "node_modules/less/test"
    ]
  }
}

I copied over the css file into my spreadsheets folder and this seemed to work fine. Not sure if this is a good idea, but copiying over the minified version would solve this problem would it not?

After update to

METEOR@1.4.3.1
---
{
  "name": "ant-design",
  "private": true,
  "scripts": {
    "start": "meteor run"
  },
  "dependencies": {
    "antd": "^2.7.4",
    "babel-plugin-import": "^1.1.1",
    "babel-runtime": "^6.23.0",
    "classnames": "^2.2.5",
    "flexboxgrid": "^6.3.1",
    "graphql": "^0.9.1",
    "indexof": "0.0.1",
    "jquery": "^3.1.1",
    "jquery-validation": "^1.16.0",
    "meteor-node-stubs": "~0.2.3",
    "moment": "^2.17.1",
    "react": "^15.4.2",
    "react-addons-pure-render-mixin": "^15.4.2",
    "react-dimensions": "^1.3.0",
    "react-dom": "^15.4.2",
    "react-flexbox-grid": "^0.10.2",
    "react-mounter": "^1.2.0",
    "react-sizeme": "^2.2.0",
    "simpl-schema": "^0.2.2",
    "uniforms": "^1.13.1",
    "uniforms-antd": "^1.13.1"
  },
  "devDependencies": {
    "babel-plugin-import": "^1.1.0",
    "babel-plugin-transform-class-properties": "^6.23.0",
    "babel-polyfill": "^6.23.0"
  }
}
----
{
  "plugins": [
    [
      "import",
      {
        "libraryName": "antd",
        "style": "css"
      }
    ],
    "transform-class-properties"
  ]
}

Get error You are using a whole package of antd, please use...

And then I tried to add

@import '{}/node_modules/antd/dist/antd.less';

But still donā€™t work

https://github.com/meteor/meteor/issues/8399 and no update :confused:

Now it work fine, if I import all of component form ant/lib...

// .babelrc
{
  "plugins": [
    [
      "import",
      {
        "libraryName": "antd"
      }
    ],
    "transform-class-properties"
  ]
}
-------------------
// in client folder (theme.less)
@import '{}/node_modules/antd/dist/antd.less';

And then

import React from 'react';
import LocaleProvider from 'antd/lib/locale-provider';
import enUS from 'antd/lib/locale-provider/en_US';

import Layout from 'antd/lib/layout';
const {Header, Sider, Content, Footer} = Layout;

import Menu from 'antd/lib/menu';
const SubMenu = Menu.SubMenu;
const MenuItemGroup = Menu.ItemGroup;

import Icon from 'antd/lib/icon';
import Breadcrumb from 'antd/lib/breadcrumb';

import Row from 'antd/lib/row';
import Col from 'antd/lib/col';
import Dropdown from 'antd/lib/dropdown';

Have a look at the issue on uniforms-antd https://github.com/vazco/uniforms/issues/219

Can I see your .babelrc too? And are you doing a theme.less file? This setup will avoid loading the full antd library?

hi, i have error with Upload component

modules-runtime.js?hash=be9fc65ā€¦:133 Uncaught Error: Cannot find module '../progress'
    at require (modules-runtime.js?hash=be9fc65ā€¦:133)
    at meteorInstall.node_modules.antd.lib.Upload.uploadList.js (modules.js?hash=bfc9cd2ā€¦:195306)
    at fileEvaluate (modules-runtime.js?hash=be9fc65ā€¦:207)
    at require (modules-runtime.js?hash=be9fc65ā€¦:130)
    at meteorInstall.node_modules.antd.lib.Upload.index.js (modules.js?hash=bfc9cd2ā€¦:194919)
    at fileEvaluate (modules-runtime.js?hash=be9fc65ā€¦:207)
    at Module.require (modules-runtime.js?hash=be9fc65ā€¦:130)
    at Module.Mp.import (modules.js?hash=bfc9cd2ā€¦:355)
    at meteorInstall.imports.estateEditor.components.StepGallery.jsx (StepGallery.jsx:1)
    at fileEvaluate (modules-runtime.js?hash=be9fc65ā€¦:207)

anyone know how to fix this? thx

EDIT: error occurs when i import Progress and Upload in the same file

import Progress from 'antd/lib/Progress'; // if i remove this line --> no error
import Upload from 'antd/lib/Upload';

@achtan I think the error is due to the wrong upper-case in import string, try:

import Progress from 'antd/lib/progress'; 
import Upload from 'antd/lib/upload';

Have not looked at the export definitions in antd but all work with lower-case export in my experience.

1 Like

Hi folks

it looks like some of your have antd running in meteor, after several tries finally I could create a project with antd running.

I create a demo sample at GitHub - enzolutions/react-antd-meteor-demo

But If you see the following image you would notice that the form is running the css/less werenā€™t compiled or included.

Could you give any recommendation about how to do that?

Outside meteor I did that using webpack but looks like meteor works in a different way.

Also, I am confused because in some replies I saw people use the babelrc file, but in all combinations, I tried always fail.

I am using ā€œantdā€: ā€œ^2.9.1ā€,

Thanks in advance for your recommendations.

Could try install less via meteor add less

Hi @theara

Thanks for your help, that was exactly what I did and in added a new file in client/theme.less to import the antd less files

@import '{}/node_modules/antd/dist/antd.less';

Thanks for your help anyway.

I am loving meteor

Kind regards

1 Like

antd works correctly in Meteor 1.4.2.6 without any ā€œhacksā€ needed (import { Radio } from ā€œantdā€; works correctly including the css required when using babel-plugin-import as it should). A later version of Meteor broke this. A related issue (https://github.com/meteor/meteor/issues/8399) has been closed but when I checked Meteor 1.4.4.1, it was still broken (and I guess more people that have been using antd are postponing upgrade of Meteor version to the later ones because of this problem)

Hi @raycone

Thanks for your reply, I am using Meteor 1.4.4.1 and Antd 2.9.1

After installing babel-plugin-import 1.1.1 and remove the theme.less file with the instruction

@import '{}/node_modules/antd/dist/antd.less';

The CSS files werenā€™t loaded, could you give more information about how to use the babel plugin import to avoid to have ti import the less file manually.

Kind regards