项目作者: harryheman

项目描述 :
Webpack 5 Boilerplate for JS/React/TS apps.
高级语言: JavaScript
项目地址: git://github.com/harryheman/Webpack5-Max.git
创建时间: 2020-11-13T08:11:36Z
项目社区:https://github.com/harryheman/Webpack5-Max

开源协议:MIT License

下载


Webpack 5 Max (JS/React/TS)

License: MIT

logo

:zap: Webpack 5 Boilerplate for JS/React/TS apps.

:link: Demo on CodeSandbox


Includes

  • 5 config files with all possible settings
    • common
    • common + development
    • common + production
    • common + production + pwa
    • common + production + analyze
  • React Todo App example
    • actions: add, complete, remove, edit, update
    • filters: all, active, completed
    • controls: mark all todos as completed, clear all completed todos
    • state management: useContext/useReducer
    • styling - react-bootstrap
    • type checking - prop-types
  • HTML template with all meta & link tags for SEO
    • don’t forget to change values in HtmlWebpackPlugin templateParameters object
  • browserconfig.xml, robots.txt, sitemap.xml
  • service-worker & manifest.json
    • don’t forget to change values in manifest.json
  • netlify.toml with all security headers

You can easily add settings for Vue or Angular components.

Vue

  • install deps
  1. yarn add -D vue-loader vue-template-compiler
  2. # or
  3. npm i -D yarn vue-loader vue-template-compiler
  • add following to config/webpack/common.js
  1. const VueLoaderPlugin = require('vue-loader/lib/plugin')
  2. module.exports = {
  3. module: {
  4. rules: [
  5. {
  6. test: /\.vue$/,
  7. loader: 'vue-loader'
  8. }
  9. ]
  10. },
  11. plugins: [
  12. new VueLoaderPlugin()
  13. ]
  14. }

Angular

  • install dep
  1. yarn add -D angular2-template-loader
  2. # or
  3. npm i -D angular2-template-loader
  • change following in config/webpack/common.js
  1. {
  2. test: /.tsx?$/i,
  3. exclude: /node_modules/,
  4. use: [babelLoader, 'ts-loader', 'angular2-template-loader?keepUrl=true']
  5. },

Installation

  1. # clone repo
  2. git clone https://github.com/harryheman/Webpack5-Max.git
  3. # install deps
  4. yarn
  5. # or
  6. npm i

Usage

Development Server

  1. yarn start
  2. # or
  3. npm start

Production Bundle

  1. yarn build
  2. # or
  3. npm run build

Production Bundle PWA

  1. yarn pwa
  2. # or
  3. npm run pwa

Production Bundle Analyzer

  1. yarn analyze
  2. # or
  3. npm run analyze

Author

Igor Agapov


License

This project is open source and available under the MIT License