use Facebook's create-react-app scaffolding to quickly build a react development environment (Ant.design,redux ...). )
The "scaffolding" in the programming field refers to a kind of tool that can quickly build a "skeleton" of the project scaffolding. For example, most react projects have src,public,webpack profiles, and so on, and the SRC directory contains components directories, and so on. Each time you create a new project, these fixed file directories are created manually. The role of scaff
Loader priority needs to be noted for two points, with the test configuration priority: Multiple loader are configured under the same test, and priority loader is placed after the configuration array, as for less processing:
{
test:/\.less$/, use
: [
' Style-loader ',
' css-loader ', '
postcss-loader
', ' Less-loader '
]
}
Different test priority: such as the processing of JS files requires two test configuration, using Eslint-loader and
is the ultimate asynchronous solution and the future). It is OK with other types of data, but it is executed directly, not asynchronously.
Second, the execution of const result = Readfileasync () Returns a Promise object, and the return ' done ' in the above code is directly received by the following then function
Result.then (data => {
console.log (data) /Done
})
Third, from the readability of the code will, async-await more easy to read the introduction, but also more in line with the s
For more information about ProjectBabel, see InstallCoreinitEX: UPDATEbabel_nodeSETnod_title 'board', nod_pid2, nod_sid2, nod_uid1, nod_level2, nod_he knows about the Babel of the Project.
After installing the Project Babel, you can see:
Install Core init
EX: UPDATE babel_node SET nod_title = 'board', nod_pid = 2, nod_sid = 2, nod_uid = 1, nod_level = 2, nod_header = 'Hello World! ', Nod_footer = 'This is
prior to reading this article, it is recommended to have a preliminary understanding of Webpack and Vuejs, through Webpack's official website and Vuejs's Chinese official website to understand canWebsite Main directory://Some files are not necessarily listed, pay attention to observeVue-wepack -src--components --js ---app.js --css-dist -package.json -webpack.config.js-index.htmlpackage.json//Note that there will be some extra loader bags, this explanation does not necessarily
1. Configure the environment: in the Webstorm console (1) cnpm install--save-dev Gulp (2) cnpm install--save-dev Gulp-webpack(3) cnpm install Babel-loader babel-core babel-preset-es2017--save-dev2. Directory structure: (The build folder is automatically generated after all files have been configured in Webstorm console after input gulp)3.gulpfile File configurati
Node. js are not supported yet. Fortunately, babel already supports async transform, so we can introduce babel when using it. Before we start, we need to introduce the following package, which contains the async/await compilation file we need in preset-stage-3.
Install the following package on both Browser and Node. js.
$ npm install babel-core --save$ npm insta
launch stage, we do not recommend this. 1. the user needs to download these three files, which wastes bandwidth. 2. Compile the jsx file on the browser after the download is complete, which wastes time and resources.
If you package and compile the project code in the development phase into a js file and then push it online, you can: 1. Reduce the number of HTTP requests to 1. 2, you do not need to waste time and resources on the client to compile the code, and directly run the compiled js Code
I. What is Webpack? What is his merit?First of all, for many just contact Webpack people, will certainly ask Webpack is what? What advantages does it have? Why should we use it? With these questions, let's summarize the following:Webpack is a front-end tool that allows modules to be loaded, preprocessed, packaged, and capable of grunt or gulp all basic functions. The advantages are as follows:
Supports COMMONJS and AMD modules.
Support for a number of module loader calls, can make t
1. Download node. js2. Open a command window under a project that requires Webpack to run NPM init build package.js3. Install Webpack, use NPM install Webpack--save-dev (installed in this directory)4. Create a new webpack.config. js in the directory of this project (the default is to access this file, if you need to change the configuration, but I do not know how to match at the moment)5. Configuring in Webpack.config. js1 varWebpack = require (' Webpack '));2Module.exports = {3 //Page Porta
As long as the normal hot load as long as the following configuration is goodPackage.json{ "devdependencies": { "webpack": "^2.6.1", "webpack-dev-server": "^2.4.5" }, " Scripts ": { " start ":" Webpack-dev-server " }}Webpack.config.jsModule.exports = { + '/js/test.js ', output: { // Note this is Publicpath publicpath: "/dist/", "Bundle_test.js" }}To use ES6 syntax, load the Babel file, and note that you nee
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 PackageWe need to install two packages, these two packages are Babel plugins.Run in Windows:NPM Install-g BabelNPM install-g
Software that needs to be installed
node. js
NPM Package Management
Webstorm
There is no need for a separate installation of NPM since the 6.3.0 version will come with NPM package managementNodejs (including NPM) installed in the default path C:\Program Files\nodejs better, not very bigAfter the Webstrom installation is complete, select License Server in the License Activation window that opens.Enter the URL in the input box: http://idea.iteblog.com/key.phpLast Click Activa
Webpack.config.js, the content is:Module.exports ={devtool:"Eval-source-map",//makes compiled code more readable and easier to debugentry: __dirname+ "/public/main.js",//The only entry file that has been mentioned many timesoutput: {path: __dirname+ "/views",//where files are stored after they are packagedFileName: "Bundle.js"//filename of the output file after packaging //equivalent to packaging all of your JS files into a JS file, into a bundle.js file }, //enables Webpack to han
to process (optional);
query: Provides additional setup options for loaders (optional)
3, the Babel configuration Babel is actually a platform for compiling JavaScript, and its strength is that it can be compiled to help you achieve the following:
Use the next generation of JavaScript code (ES6,ES7 ... ), even though these standards are not currently fully supported by the current brow
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.