Right. Blindly install such a package without knowing what it does. Good job.
This is the exact kind of thinking which led to the âpadleftâ debacle where people were unable to code their way out of a wet paperbag without installing modules.
Right. Blindly install such a package without knowing what it does. Good job.
This is the exact kind of thinking which led to the âpadleftâ debacle where people were unable to code their way out of a wet paperbag without installing modules.
I prefer added indexof in my dependencies rather thant recode Ant DesignâŚ
Have you look about indexof ?
var indexOf = [].indexOf;
module.exports = function(arr, obj){
if (indexOf) return arr.indexOf(obj);
for (var i = 0; i < arr.length; ++i) {
if (arr[i] === obj) return i;
}
return -1;
};
Itâs just thatâŚ
So add this somes lines rather the powerfull lib⌠I made my choice.
Jesus Christ. Yes, exactly what I was expecting: Another version of âpadleftâ.
Naw, if they canât code that without using an npm module then count me out. I really donât want to know what the rest of their code looks like.
Not to mention that if their stuff depends on this module - then maybe they should include it in the frickinâ dependencies? Isnât that the whole point of npm?
Thatâs not how npm philosophy works.
They are (also) created to be small, reusable blocks.
It makes no sense for each package to include a lame workaround for indexof, forcing all the packages to be updated if a bug is discovered.
Then, getting back to the issue I think you all should write posts after a little bit of investigation on the issue because:
try {
var index = require('indexof');
} catch (err) {
var index = require('component-indexof');
}
That is the relevant code, and it would have prevented several posts unrelated to the real problem.
Apart from that I can confirm there are some issues with babel-plugin-import since it doesnât work as excepted.
Also tried with a base react meteor app, added antd, babel-plugin-import, configured antd plugin and it doesnât work, all the antd module and there is no style.
I can create a github repo to reproduce the problem if someone wants to take a look.
I think the problem was missing a simple import of an antd CSS file.
import 'antd/dist/antd.css';
I havenât tried that yet, but I was doing some paired programming with a client and they got it working, and thatâs the only difference I could see between my Ant setup and theirs.
But thereâs still a warning about using babel import whatever-it-is, even though itâs installed. Doesnât seem to work with the Meteor build system.
anyone getting this error:
/Users/admin/sites/real/node_modules/antd/lib/style/index.css:10
html {
^
Unexpected token {
...
?
Listen, this ânpm wayâ is the exact reason why quite a number of sites were broken due to the âPadleft debacleâ. You might want to take a look at that to discover why putting such stupid stuff into modules is a bad idea.
Not to mention that the author of âindexofâ is doing polyfills wrong. It should look like this:
if (!Array.prototype.indexOf) Array.prototype.indexOf = function (searchElement, fromIndex) { ...
No itâs not, site were broken because npm implementation is (was? I think some improvements were made so that a similar case wonât happen again) a mess, not because padleft was a small building block.
Also the author is not doing polyfill because doing so would possibly break all the for in usage of arrays, since user-defined properties are enumerated.
Note that I will not continue this conversation so this is the last answer you will get from me, Iâm here because I would really like to start using antd in some of my projects, pointless arguments about the pros and cons of npms are of no interest to me.
Getting back to antd
import 'antd/dist/antd.css';
Doesnât seem a good idea since it includes the whole css.
The point of using babel-import-plugin is that it includes only the minimum required js and css, I donât want to include the whole library and css.
For now Iâm manually importing js and css like
import DatePicker from 'antd/lib/date-picker';
import 'antd/lib/date-picker/style/css';
which is not as nice as Iâd like but still better than nothing, I guess.
and what about less variables? are they working whit this approach?
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.
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?
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
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';