benoitvallon / react-native-nw-react-calculator

Mobile, desktop and website Apps with the same code
MIT License
5.21k stars 864 forks source link

Multiple platforms - build configuration question #31

Closed dstudzinski closed 3 years ago

dstudzinski commented 7 years ago

Hi, Could you explain how build tools 'knows' which files to import? For example when you use import Render from './KeyRender'; how it knows if choose KeyRender.js, KeyRender.android.js or KeyRender.ios.js? I can't find place where it's configured. For example when I want to change suffixes from .android.js to .myandroid.js which config should I edit?

EDIT: Ok, I think I found it: https://facebook.github.io/react-native/docs/platform-specific-code.html#platform-specific-extensions So react-native uses .android.js or .ios.js files (if exists - if not rn uses .js files) Webpack (used for desktop and web) uses .js files

pngyongjun commented 3 years ago

https://facebook.github.io/react-native/docs/platform-specific-code.html#platform-specific-extensions