-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
About module entry es folder usage #1575
Comments
babel-plugin-import have a option.libraryDirectory, set it to
Without |
If I Webpack understand |
It will load The problem is not what the pkg.es should be point to. It all because that antd-mobile won't encourage users load component without |
No. Currently it will load Set pkg.module and bring webpack goto find warn.js. it's wrong. |
What's your proposal api actually? give some code is better. My point is: antd-mobile won't encourage users load component without babel-plugin-import, so both pkg.main and pkg.es need point to a empty warning file, not a real entry. see pkg.module |
痛点少一个是一个! My point is 砍掉所有入门的门槛,这些门槛其实都属于高级用法,非必选。
以上是我认为这个项目目前的四大痛点。 目前的状况是用户想尝试一下,安装以后配置半天还不一定成功,少部分不肯放弃的人跑到这里开 issus 也未必找到解决办法。 |
你列的四点,后面三点在已经在2.0的改进计划中。 至于 entry 是否要放开限制,也不是不可行,还是个取舍问题,可能减少了入门的咨询,反而增加了后面关于打包后体积很大的咨询量。 除了运行时 console warning,大部分普通用户不会想着去文档里面找按需加载的方案的。 |
另外,真正在业务上,我认为对移动端来说 antd-mobile 这样的库全量引入基本是不可能的。 所以绝大多数的用户,肯定是需要配置 babel-plugin-import 才对。 |
是否全量引入那是用户的事,教会用户怎么用 关闭 main 入口就是我们的不对了。 |
这个用户的心声应该很能说明问题了, |
ok, 那我的提议是这样。 保持 main 入口可以正常引用,但在 index.js 里面加 dev warning, 建议用户做按需加载。 @cncolder 你有兴趣来个 PR 吗? |
不判断 dev 环境,就普通 cosole.error, 效果就是线上也要有这个 console warning. |
然后再加一个变量或方法用于关闭 warning 吗?我不认为 warning 有必要。 如果替用户考虑,应该把这几个要点放在根目录的 README.md 里,现在的首页只有LOGO和几个二维码。 参考 |
我的意思就是这个 warning 是不可关闭的。
我们的 Readme 有点像个导航菜单或产品首页,https://github.com/ant-design/ant-design-mobile#install--usage 这里会跳转到真正的使用文档。 |
就是把 introduce.md 的内容复制到外面,放在明面上。 |
antd 是对的,尽到提醒义务,要是用户连这个都看不懂,应该也学不会 React(玩笑)。 |
@cncolder 的确,antd-mobile 的新手友好度和配置复杂度经常被吐槽... 😅 直接 PR 来优化吧 👍 |
@paranoidjk 我再继续整理思路,想办法解决前两个问题,你继续解决 npm publish 问题,我在等下一个 |
close since antd-mobile@2.0 have unlocked this restriction. https://github.com/ant-design/ant-design-mobile/blob/master/package.json#L31 |
What problem does this feature solve?
So now we use
babel-plugin-import
to reduce bundle size. Thepkg.main
andpkg.module
entry all pointwarn.js
. There is no way import es6 module.What does the proposed API look like?
Consider change
pkg.module: es
? But I'm not sure if work as expect.pkg.module
for rollup or webpack tree shaking. Webpack only bundle referencedd components if correct config./es/warn.js
is useless.The text was updated successfully, but these errors were encountered: