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
<!--public/index.html--> | |
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<script type="text/javascript" src="/dist/legacyLib.js"></script> | |
</head> | |
<body> | |
</body> |
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
var legacyLib = legacyLib || {}; | |
(function () { | |
legacyLib.pageLoadTime = new Date(); | |
legacyLib.authorize = function () { | |
console.log("Authorize function invoked.") | |
} | |
})(); |
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
declare namespace legacyLib { | |
let pageLoadTime: Date; | |
function authorize(): void; | |
} |
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
const path = require('path'); | |
const CopyWebpackPlugin = require('copy-webpack-plugin') | |
module.exports = { | |
entry: { | |
main: './src/index.js' | |
}, | |
output: { | |
filename: 'main.js', | |
path: path.resolve(__dirname, 'dist') |
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
const CopyWebpackPlugin = require('copy-webpack-plugin'); | |
module.exports = function override(config, env) { | |
if (!config.plugins) { | |
config.plugins = []; | |
} | |
config.plugins.push( | |
(process.env.NODE_ENV === 'production') ? | |
new CopyWebpackPlugin([{from: 'src/lib/legacyLib.js'}]) : |
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
// public/index.html | |
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> | |
<meta name="theme-color" content="#000000"> | |
<link rel="manifest" href="%PUBLIC_URL%/manifest.json"> | |
<link rel="shortcut icon" href="%PUBLIC_URL%/favicon.ico"> |
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
Show hidden characters
{ | |
"compilerOptions": { | |
"baseUrl": ".", | |
"emitDecoratorMetadata": true, | |
"experimentalDecorators": true, | |
"target": "es5", | |
"module": "esnext", | |
"moduleResolution": "node", | |
"jsx": "react", | |
"outDir": "artifacts", |
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 = { | |
getTransformModulePath() { | |
return 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
"jest": { | |
"preset": "react-native", | |
"moduleFileExtensions": [ | |
"ts", | |
"tsx", | |
"js" | |
], | |
"transform": { | |
"^.+\\.(js)$": "<rootDir>/node_modules/babel-jest", | |
"\\.(ts|tsx)$": "<rootDir>/node_modules/ts-jest/preprocessor.js" |
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
{ | |
"presets": ["module:metro-react-native-babel-preset"], | |
"plugins": [ | |
[ | |
"@babel/plugin-proposal-decorators", | |
{ | |
"legacy": true | |
} | |
] | |
] |