百科.dev
全部条目在线工具AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
W

webpack-react-boilerplate

> 前端框架
开源

使用 babel 7、新的 webpack-dev-server、react-hot-loader、CSS-Modules 的最小 React 16 和 Webpack 4 示例代码

391 stars0 点赞1 次浏览
访问官网GitHub

工具介绍

使用 babel 7、新的 webpack-dev-server、react-hot-loader、CSS-Modules 的最小 React 16 和 Webpack 4 示例代码

Minimal React and Webpack 4 boilerplate with babel

Minimal webpack and react boilerplate using latest version of react and babel as well as jest and enzyme for more details about technologies used. click with real time server changes ;)

check out Medium article for more details

Table of contents

Project structure

Installation

Configuration

Technologies used

Project structure

build/
src/
|- index.jsx _______________________________ # Application entry
|- App.jsx _________________________________ # Application init
|  |- Components/
|    |- hello-world/
|       |- index.jsx _______________________ # Sample component

webpack
|- paths.js ________________________________ # webpack paths needed
|- webpack.common.js _______________________ # common webpack config
|- webpack.dev.js __________________________ # development config
|- webpack.prod.js _________________________ # production config

Installation

1- Clone the boilerplate repo

git clone [email protected]:HashemKhalifa/webpack-react-boilerplate.git

2- yarn or npm install to install npm packages

3- start dev server using yarn start or npm start.

3- build and bundling your resources for production yarn build.

4- Unit testing will watch all your changes in the test files as well as create coverage folder for you. yarn test

Configuration

  • Webpack Config paths based on your file structure you can go to webpack/paths.js and modify the source and file names based on your need.
  • webpack/webpack.common.js config common webpack for both dev and production environments.
  • webpack/webpack.dev.js config webpack for dev environment.
  • webpack/webpack.prod.js config webpack for production environment.
  • /webpack.config.js main webpack config that merge common and webpack environment based config.
  • Enzyme config /setupTest.js here you will have all setup for enzyme to test your component.
  • Prettier config /.prettierc.
  • Browsers list config /.browserslistrc.

Technologies used

  • Webpack 4
  • Babel 7 [ transforming JSX and ES6,ES7,ES8 ]
  • React 16.8
  • Lodash
  • Jest [ Unit test]
  • Enzyme for UI testing.
  • Eslint with airbnb config
  • Prettier [ Code formatter ]
  • Style & CSS Loader & SASS-loader
  • CSS modules [ Isolated style based on each component ]
  • Browsers list [ Share target browsers between different front-end tools, like Autoprefixer, Stylelint and babel-preset-env ] React Fast Refresh[For react hot module replacement]
  • Webpack dev serve

Issues· 0 开放

查看全部 Issues在 GitHub 打开

暂无开放 Issues,或尚未同步最近议题。

> 标签

JavaScriptbabelcss-modulesenzymeeslint

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月17日
分类前端框架
定价开源

> 相关工具

R
React
用于构建用户界面的 JavaScript 库
V
Vue.js
渐进式 JavaScript 框架
N
Next.js
基于 React 的全栈 Web 框架