How to configure react, jsx, and babel in Visual Studio Code? - visual-studio-code

I want to start learning ReactJs with jsx and Babel. My editor is Visual Studio Code. I need to config them to work together in VSCode, but after search in Google and StackOverFlow, I found dispersed contents for different frameworks and platforms. Is there any resource to learn step by step configuration and using react in VSCode?
Thanks a lot

I found babel-standalone in GitHub .
babel-standalone is a standalone build of Babel for use in non-Node.js environments, including browsers. It's bundled with all the standard Babel plugins and presets, and a build of babili (babel-minify) is optionally available too.
With babel-standalone we can compile out JavaScript files with jsx format in browser. Easy installation and usage.

Related

Customize babel configuration in project created using create-react-app

I want to use a babel plugin (babel-plugin-module-resolver) in a project created using create-react-app.
I know how to change babel configuration using npm run eject, but I would like to avoid it.
I was going to use react-app-rewired but I heard that there is the possibility to configure babel without ejecting and without additional libraries.
(if possible), how can I do it?

Google Cloud Functions: How to setup Intellij (or other IDE) to have Code completion with NodeJS8

I'm starting with Google Cloud Functions (triggered by pub/sub), and I'm looking how to setup IntelliJ (Ultimate) or use another IDE to have syntax highlighting, code completion.
Do you know if it's possible with IntelliJ or another IDE?
My goal is to have a decent development environment and have the sources on Github.
I've been able to setup a correct project layout for github integration here : Google Cloud Functions: Project layout for Github publishing
I do have syntax highlighting working, but the code completion is currently the basic javascript. Libraires are not integrated in code completion.
So after having find how to setup the layout of my project here : Google Cloud Functions: Project layout for Github publishing
On each package.json, in IntelliJ Ultimate (don't know for community edition), I click "run npm install".
Once it's done and the project is reindexed, I have code completion from the libraries.
The downside of this aproach is that you have multiple node_modules folder, about 50MB each, but storage is not that expensive so...

How to create a babel plugin for internal use

How do we use a babel plugin that is not already accepted in a babel repository? I had trouble finding this answer reading through the babel plugin documentation.
We are interested in writing a babel plugin for for...in loops to address a bug in ios9 (ios9 Safari miscalculating sum). Although we would be happy to contribute it to the babel community, I was also wondering if it doesn't get accepted or isn't ready for general consumption, how to start using and testing it locally.
It's possible to make use of custom babel plugins that you can host on git.
You can refer to https://github.com/jamiebuilds/babel-handbook/blob/master/translations/en/plugin-handbook.md for learning how you can develop and test your babel plugin locally.
Once you have developed the plugin, you can add a dependency for it in your project's package.json file.
Note that if you plan to make the plugin repository private, you'd have to create a personal access token (for Github) to allow npm to fetch repository contents. In that case, the example entry in your package.json file would be as follows:
"babel-plugin-transform-for-of-loop": "git+https://{token}:x-oauth-basic#github.com/username/babel-plugin-transform-for-of-loop"
Whatever package name that you pick for your plugin, you will need to add a reference for it in the .babelrc file. For this example, it would be as follows:
{
...
"plugins": [
"babel-plugin-transform-for-of-loop"
]
}
With that done, you should simply run npm install and your plugin would become active for your project.

Linking Bootstrap to my VS Code project

I am going through VS Code for the first time and doing a bootstrap project. I used the marketplace to add bootstrap 4 and font awesome (install & reloaded) what else do I need to do?
As my project folder does not have and bootstrap files, but strangely the intellisense let's me use the bootstrap snippets. I ran the index.html and the page wasn't bootstrap styled. The download didn't add any files to my project.
Any suggestions?
You mixed up some things. The extensions that you installed are more for quick coding of Bootstrap and for visualizing it better.
However Bootstrap is not installed on your site, which is a totally different process. You can achieve this in many ways. (npm, bower)
I would recommend you to read the Bootstrap getting started documentation.
(It's for Bootstrap 3 but it's the same principle)
Documentation

Code to generate templates

I just downloaded Visual Studio Code last night. What do I do so that Code will generate, say, a Console Application template?
I've read around the web so far I can't find anything telling me how to create a template.
Q: How do I create and run a new project?
A: VS Code doesn't include a traditional File > New Project dialog or
pre-installed project templates. You'll need to add additional
components and scaffolders depending on your development interests.
With scaffolding tools like Yeoman and the multitude of modules
available through the NPM package manager, you're sure to find
appropriate templates and tools to create your projects.
for details: https://code.visualstudio.com/docs/setup/setup-overview
and a question on SO: Run C# Console Application on Visual Studio Code Editor on Windows