3 ms·
I'd actually love to see a good blog post that details the process of, say, upgrading from Babel 6 to Babel 7 for a non-CRA app, and then adding in some form of
by acemarke 8y ago
I'd actually love to see a good blog post that details the process of, say, upgrading from Babel 6 to Babel 7 for a non-CRA app, and then adding in some form of TS support on top of that. (I've got a couple apps that I'd like to try doing that with myself in the not too distant future.)
- streptomycin 8y agoThey are independent, so you could read two blog posts, one for Babel 7 https://babeljs.io/docs/en/v7-migration https://babeljs.io/docs/en/v7-migration and one for TS https://blogs.msdn.microsoft.com/typescript/2018/08/27/typescript-and-babel-7/ https://blogs.msdn.microsoft.com/typescript/2018/08/27/types...
- ianschmitz 8y agoCheck out https://github.com/strothj/react-app-rewire-typescript-babel-preset https://github.com/strothj/react-app-rewire-typescript-babel... for an example I helped get going. It was fairly straight forward!
- acemarke 8y agoThanks, appreciate it!
- sbr464 8y agoI don’t have a post but I took a half hour the other day and did it, it was basically: Add typescript, babel typescript, add the plugin in babelrc, and update the Babel cli build command in package.json to look for ts file extensions. That enabled me to start incrementally adding typescript into an existing node.js codebase, I was surprised how easy it was.
- sbr464 8y agoHere were the changes to get typescript working with an existing node.js codebase (babel 7) package.json (scripts) BABEL_ENV=development babel -d build/ src/ --extensions \".ts,.tsx,.js\" --quiet --source-maps inline package.json (add property) "type-check": "tsc", package.json (dev depenencies) @babel/preset-typescript, typescript babelrc (add with env) presets: ["@babel/typescript"] tsconfig (example) { "compilerOptions": { "target": "esnext", "module": "commonjs", "declaration": true, "outDir": "build", "strict": true, "allowSyntheticDefaultImports": true, "esModuleInterop": true, "skipLibCheck": true } }