react-redux-webpack-starterLearning react

联合创作 · 2023-09-22 23:11

React-babel-webpack-es6 Starter Project

A boilerplate using React, webpack and hot module reloading, and ES6 + JSX via Babel.You could use it as a base to build your own web app.

Features

The provided boilerplate enables client-side ES6 via the following technologies:

  • webpack and webpack-dev-server as a client-side module builder and module loader.
  • npm as a package manager and task runner
  • Babel 6 as a transpiler from ES6 to ES5.
  • React and JSX as a virtual Dom JavaScript library for rendering user interfaces (views).
  • ESLint as a reporter for syntax and style issues. eslint-plugin-react for additional React specific linting rules.
  • Sass as a compiler of CSS styles with variables, mixins, and more.
  • Inline base64 URLs for images and fonts if their size is less than specified limit of file-loader
  • Image compression processing of image-webpack-loader
  • Watch index.html for changes of html-webpack-plugin

Getting Started

Installation

you should clone the repo and install the dependencies.

$ git clone https://github.com/chenbin92/react-redux-webpack-starter.git app-name
$ cd app-name
$ npm install  //or cnpm install

Development

In the development mode. launch the boilerplate app:

// run the dev server http://localhost:8080

$ npm start  

you should see a new browser tap opening and a title of "Hello React” in http://localhost:8080/, page hot reloads automatically when there are changes

homepage

When you run npm start:

  • The sass-loader compiles Sass into CSS
  • Webpack bundles the compiled CSS、JS into bundle.js

Production

In the production mode, you can:

// run the prod server http://localhost:9090

$ npm run start: prod
// build the static files.

$ npm run build 

npm run build. This will prepare and build the project for production use. It does the following:

  • Minifies all JS and CSS
  • Inline base64 URLs for images and fonts if their size is less than specified limit
  • Sets NODE_ENV to production so that React is built in production mode
  • Places the resulting built project files into /build directory

All configuration tasks

  • npm start: start the development model of server
  • npm run start:prod: start the production model of server
  • npm run build: compile code in production mode
  • npm run lint: lint with ESlint and Airbnb's style sheet.
  • npm run lint:watch: eslint watching
  • npm run remove:build: remove the dist directory
  • npm run clean:build : clean the dist directory

TODO

  • add test

Others

浏览 6
点赞
评论
收藏
分享

手机扫一扫分享

编辑 分享
举报
评论
图片
表情
推荐
点赞
评论
收藏
分享

手机扫一扫分享

编辑 分享
举报