Re:Create React App 2.0: Babel 7, Sass, and More
by acemarke on Monday October 01, 2018 @10:47PM
(#18118478)
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.)
Re:Create React App 2.0: Babel 7, Sass, and More
by sbr464 on Tuesday October 02, 2018 @01:27AM
(#18119030)
I 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.
Re:Create React App 2.0: Babel 7, Sass, and More
by sbr464 on Tuesday October 02, 2018 @03:46AM
(#18119530)
Here 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
}
}
Re:Create React App 2.0: Babel 7, Sass, and More
by ianschmitz on Tuesday October 02, 2018 @12:51AM
(#18118891)
Check out https://github.com/strothj/react-app-rewire-typescript-babel... for an example I helped get going. It was fairly straight forward!
Re:Create React App 2.0: Babel 7, Sass, and More
by acemarke on Tuesday October 02, 2018 @01:23AM
(#18119020)
Thanks, appreciate it!
Re:Create React App 2.0: Babel 7, Sass, and More
by streptomycin on Monday October 01, 2018 @11:27PM
(#18118600)
They are independent, so you could read two blog posts, one for Babel 7 https://babeljs.io/docs/en/v7-migration and one for TS https://blogs.msdn.microsoft.com/typescript/2018/08/27/types...
Re:Create React App 2.0: Babel 7, Sass, and More
by Vinnl on Tuesday October 02, 2018 @03:28AM
(#18119459)
Then you'd still need to explicitly do type checking, which is the primary advantage of TypeScript. I guess my IDE can do that, but then I'd still need to add an extra step to my CI server, etc.
Native TypeScript support will be a huge improvement.
I've setup about 4 projects over the past year, if you feel like you need help feel free to email me any particular pain points you have and I'll try to get you through them, email in profile (not a react contributor, just frequent react/typescript user on financial applications)