-
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
修复在同构项目中, 因该依赖问题导致node端在没有react-native 的环境下,会提示找不到该模块, 实际上,即使有react-… #758
Conversation
…native 模块也会有其他的错误爆出。 目前该问题并没有在纯前端渲染的模式中体现出来。
关联 #757 。这个不光是 list 组件这么做,其他组件也都这么做的。目前算是不支持同构的。 同构的支持后续会尝试做,但需要测试所有组件,还需要考虑 RN,再确认统一的修改方案。 |
@warmhug 从代码上来看, 在 .web 的文件中, 将所有组件(.web 的组件)的内部组件以来改为 .web 是否就可以了? |
理论上 .web.tsx 文件里引用 web 子文件的时候,最好还是要指定引用为 .web 后缀,类似 PR 里提的这个,我们还是要 check 一下现有组件,都改过来 @warmhug |
@yiminghe 说过不加 web 后缀 |
@warmhug 为啥呢? 感觉 .web 的只引入 .web 是合理的吧?不求甚解! |
https://github.com/react-component/m-date-picker/blob/910676ce8c71fc17f2c05a432afe7346efcc2c38/src/Popup.tsx#L3 类似这些底层依赖也要改了才行,要改改动的地方也比较多的。 |
@warmhug 那意思是可改, 只是改的地方较多。 这个意思? |
其实我需要看到一个结论, 是不是需要改? 需要的话我可以 one by one 的改过来。 项目急需用, 啊哈哈 |
@inJs 年后上班再确认结论,先休息过年~ |
@warmhug 这个pr 最终方案怎么定? |
@inJs 这个按照你 pr 的方式来改 |
@silentcloud ok, 那我去办 |
这个pr 什么时候合过去? |
@yiminghe review 下看看有没问题 |
不要这样改,有些组件不能改,尝试在nodejs端修改 require.extensions['.js'] = function(module, filename) {
if(fs.exists(filename+'web.js')) filename=filename+'web.js';
return module._compile(transform(filename), filename);
}; |
7af2647
to
6096faf
Compare
@yiminghe transform 是什么函数? |
@qqnp1100 babel.transform , 文档地址: https://babeljs.io/docs/usage/api/ |
…native 模块也会有其他的错误爆出。 目前该问题并没有在纯前端渲染的模式中体现出来。
First of all, thanks for your contribution! :-)
Please makes sure these boxes are checked before submitting your PR, thank you!
npm run lint
and fix those errors before submitting in order to keep consistent code style.