REACTJS Environment Construction

Source: Internet
Author: User

1.ReactJs relies on the NODEJS environment and needs to be installed if Nodejs is not installed. : https://nodejs.org/en/download/

After downloading, install the Windows version of MSI, click Next to do it. After that, the appropriate environment configuration will be OK.

2. Installing the Global Package

We need to install two packages, these two packages are Babel plugins.

Run in Windows:

NPM Install-g Babel

NPM install-g BABEL-CLI

3. Create an App root directory

D:>mkdir Reactapp

D:>CD Reactapp

d:\reactapp> NPM Init

4. Add the corresponding dependent webpack (--save command will add a package to the Package.json file)

D:\REACTAPP>NPM Install Webpack--save

D:\REACTAPP>NPM Install Webpack-dev-server--save

5. Installing react

D:\REACTAPP>NPM Install react--save

D:\REACTAPP>NPM Install React-dom--save

6. Install Babel other plugins

D:\REACTAPP>NPM Install Babel-core

D:\REACTAPP>NPM Install Babel-loader

D:\REACTAPP>NPM Install Babel-preset-react

D:\REACTAPP>NPM Install babel-perset-es2015

7. Create the appropriate file (index.html,app.jsx,main.js,webpack.config.js)

D:\reactapp>cd.>index.html

D:\reactapp>cd.>app.jsx

D:\reactapp>cd.>main.js

D:\reactapp>cd.>webpack.consig.js

8. Configure compilation, service, and load

Edit the Webpack.config.js file, which can be edited with Webstrom.

The contents are as follows:

      

var config = {   entry: './main.js ',   output: {      path: '/',      filename: ' Index.js ',   },   devserver: {      Inline:true,      port:8080   },   module: {      loaders: [         {            test:/\.jsx?$/,            exclude:/node_ modules/,            loader: ' Babel-loader ',            query: {               presets: [' es2015 ', ' React ']            }         }      ]   } }module.exports = config;
The appropriate configuration.

REACTJS Environment Construction

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.