Created
March 5, 2019 09:25
-
-
Save ShaMan123/868601d3570444954586117db7ea336c to your computer and use it in GitHub Desktop.
config files for RN>0.57.4, including typescript (rn-cli.config.js, tsconfig.json)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports = function (api) { | |
api.cache(true) | |
return { | |
//decoratorsBeforeExport | |
"presets": ["module:metro-react-native-babel-preset"], | |
"plugins": [ | |
["module-resolver", { | |
"root": ["./src"], | |
"extensions": [".js", ".ts", ".tsx", ".ios.js", ".android.js"] | |
}], | |
"@babel/plugin-transform-runtime", | |
"@babel/plugin-transform-flow-strip-types", | |
["@babel/plugin-proposal-decorators", { "legacy": true }], | |
["@babel/plugin-proposal-class-properties", { "loose": true }], | |
//"@babel/plugin-transform-regenerator", | |
//"@babel/plugin-transform-async-to-generator", | |
//"@babel/plugin-transform-runtime" | |
], | |
//"sourceMaps": true, | |
"env": { | |
"production": { | |
"plugins": ["transform-remove-console"] | |
} | |
} | |
}; | |
} | |
// https://github.com/facebook/react-native/issues/21475#issuecomment-432509636 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports = { | |
transformer: { | |
babelTransformerPath: require.resolve('react-native-typescript-transformer') | |
}, | |
getSourceExts() { | |
return ["ts", "tsx"]; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"compilerOptions": { | |
"outDir": "./transpiled", | |
"baseUrl": ".", | |
//"noEmitOnError": false, | |
"allowJs": true, | |
"experimentalDecorators": true, | |
"allowSyntheticDefaultImports": true, | |
"esModuleInterop": true, | |
"isolatedModules": true, | |
"jsx": "react-native", | |
"lib": [ "es6" ], | |
"moduleResolution": "node", | |
"noEmit": true, | |
"strict": true, | |
"target": "esnext", | |
"types": [ | |
"jest", | |
"lodash", | |
"react", | |
"react-native", | |
"react-test-renderer" | |
], | |
"paths": {} | |
}, | |
"exclude": [ "node_modules", "**/deprecated/*", "**/deprecated/**/*" ] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
you need to install dependencies: