项目作者: syanbo

项目描述 :
React Native 相关,Prettier ESLint Redux Rematch使用
高级语言: JavaScript
项目地址: git://github.com/syanbo/RNPlayground.git
创建时间: 2018-04-01T18:30:32Z
项目社区:https://github.com/syanbo/RNPlayground

开源协议:

下载


React-Native

设置路径别名支持IDE跳转联想

  • yarn add -D babel-plugin-root-import
  • babel.config.js 添加 plugins
  1. module.exports = {
  2. presets: ['module:metro-react-native-babel-preset'],
  3. plugins: [
  4. [
  5. 'babel-plugin-root-import',
  6. {
  7. paths: [
  8. {
  9. rootPathPrefix: '~',
  10. rootPathSuffix: 'src',
  11. },
  12. ],
  13. },
  14. ],
  15. ],
  16. };
  • 在项目根目录下添加jsconfig.json
  1. {
  2. "compilerOptions": {
  3. "jsx": "react-native",
  4. "allowSyntheticDefaultImports": false,
  5. "experimentalDecorators": true,
  6. "baseUrl": ".",
  7. "paths": {
  8. "~/*": ["src/*"]
  9. }
  10. },
  11. "include": ["src/**/*"],
  12. "exclude": ["node_modules"]
  13. }
  • 在项目中愉快的使用
  1. import env from '~/constants/env';

配置多环境