🚀基于Webpack 5,TypeScript,React的MPA多页面应用实践配置

Overview

Pages PRs Welcome

Logo

基于Webpack 5TypeScript,ReactMPA多页面应用实践配置

  • react
  • webpack
  • typescript
  • sass
  • eslint
  • prettierrc

Usage

git clone https://github.com/19Qingfeng/pages  克隆仓库

yarn 安装依赖

yarn dev 启动开发环境

yarn build 构建生产环境包

yarn build-all  构建所有页面生产环境包

推荐使用yarn基于项目yarn.lock替代npm进行项目环境安装

Documentation

  • src/packages 目录为入口文件目录,每个目录下包含main.txs入口文件以及menu-list.ts对应的菜单路由列表。

  • src/containers 目录对应不同页面业务逻辑目录,每个container下分别包含:

    • assets静态资源目录

    • views不同路由页面配置

    • styles当前模块下的样式文件列表

    • index.scss当前模块下的入口scss文件。(当前模块所有scss文件都需要在此文件引入,并且该位置必须要在container/**/index.scss)。

  • src/layout 目录对应公用layout配置

  • layout对应的样式文件需要单独在每个模块的入口文件中引入。

= src/styles 存放全局公用variable以及mixins,reset相关公用样式。

快速上手

  • src/packages 页面级别入口文件目录放置。
  • src/containers 页面级别业务逻辑处理
  • src/components 页面级别公用组件
  • src/styles 页面级别scss工具方法
  • src/utils 页面级别js工具方法

src级别目录可以通过alias进行访问

比如src/**->@src/**,src/components/**->@components/**...

原则上每个页面可以在src/container/**中组织不同页面各自的目录结构,但是推荐多页面目录保持一致。

开发

  • yarn dev

项目会根据packages中的文件夹内容动态读取页面文件夹个数提供用于使用者选择,最终生成多页应用开发环境。

构建

  • yarn build

项目会根据packages中的文件夹内容动态读取页面文件夹个数提供用于使用者选择,最终构建生成多页应用生产包。

  • yarn build-all

构建项目中所有应用。

更新日志

9.27

  • 增加css-loader,针对css进行处理。

  • dev模式下增加eslint-webpack-plugin检测并autofix代码。

You might also like...

This project is a boilerplate for Next and TypeScript projects. This template was built with Vite, TypeScript and Stitches.

This project is a boilerplate for Next and TypeScript projects. This template was built with Vite, TypeScript and Stitches.

Awesome Template Stitches — NextJS, TypeScript, Stitches and Design Tokens Summary About this template Avaliale scripts Other scripts available Main t

Dec 29, 2022

TypeScript CLI for creating HTML & CSS & TypeScript project with different bundlers, v2022.10.23 is ready on NPM

TypeScript CLI for creating HTML & CSS & TypeScript project with different bundlers, v2022.10.23 is ready on NPM

TSCI CLI TypeScript CLI for creating HTML & CSS & TypeScript project with different bundlers. Installation npm i -g tsci Usage Want to contribute? You

Dec 14, 2022

Elegant and all-inclusive Node.Js web framework based on TypeScript. :rocket:.

Elegant and all-inclusive Node.Js web framework based on TypeScript. :rocket:.

https://foalts.org What is Foal? Foal (or FoalTS) is a Node.JS framework for creating web applications. It provides a set of ready-to-use components s

Jan 4, 2023

wolkenkit is an open-source CQRS and event-sourcing framework based on Node.js, and it supports JavaScript and TypeScript.

wolkenkit is an open-source CQRS and event-sourcing framework based on Node.js, and it supports JavaScript and TypeScript.

wolkenkit wolkenkit is a CQRS and event-sourcing framework based on Node.js. It empowers you to build and run scalable distributed web and cloud servi

Dec 26, 2022

Fast and type-safe full stack framework, for TypeScript

Fast and type-safe full stack framework, for TypeScript

Fast and type-safe full stack framework, for TypeScript Why frourio ? Even if you write both the frontend and backend in TypeScript, you can't statica

Dec 26, 2022

A Programming Environment for TypeScript & Node.js built on top of VS Code

Programming Environment for TypeScript & Node.js A battery-included TypeScript framework built on top of Visual Studio Code Website Kretes is a progra

Dec 11, 2022

A new Node.js resource built using Gatsby.js with React.js, TypeScript, and Remark.

Nodejs.dev Nodejs.dev site built using Gatsby.js with React.js, TypeScript, SCSS, and Remark. You can find the latest Figma design protype here. 🚀 Ge

Jan 5, 2023

Next-gen, highly customizable content editor for the browser - based on React and Redux and written in TypeScript. WYSIWYG on steroids.

ReactPage ReactPage is a smart, extensible and modern editor ("WYSIWYG") for the web written in React. If you are fed up with the limitations of conte

Jan 6, 2023

ORM for TypeScript and JavaScript (ES7, ES6, ES5). Supports MySQL, PostgreSQL, MariaDB, SQLite, MS SQL Server, Oracle, SAP Hana, WebSQL databases. Works in NodeJS, Browser, Ionic, Cordova and Electron platforms.

ORM for TypeScript and JavaScript (ES7, ES6, ES5). Supports MySQL, PostgreSQL, MariaDB, SQLite, MS SQL Server, Oracle, SAP Hana, WebSQL databases. Works in NodeJS, Browser, Ionic, Cordova and Electron platforms.

TypeORM is an ORM that can run in NodeJS, Browser, Cordova, PhoneGap, Ionic, React Native, NativeScript, Expo, and Electron platforms and can be used

Jan 3, 2023

TypeScript ORM for Node.js based on Data Mapper, Unit of Work and Identity Map patterns. Supports MongoDB, MySQL, MariaDB, PostgreSQL and SQLite databases.

TypeScript ORM for Node.js based on Data Mapper, Unit of Work and Identity Map patterns. Supports MongoDB, MySQL, MariaDB, PostgreSQL and SQLite datab

Dec 31, 2022

🦩 Joi like validations for TypeScript

🦩 Computed Types Runtime validation types for TypeScript. Computed-Types (formerly: Funval) is a strongly-typed validation library for TypeScript. Us

Jan 4, 2023

Functional reactive programming library for TypeScript and JavaScript

Functional reactive programming library for TypeScript and JavaScript

Bacon.js A functional reactive programming lib for TypeScript JavaScript, written in TypeScript. Turns your event spaghetti into clean and declarative

Jan 1, 2023

A framework for real-time applications and REST APIs with JavaScript and TypeScript

A framework for real-time applications and REST APIs with JavaScript and TypeScript

A framework for real-time applications and REST APIs with JavaScript and TypeScript Feathers is a lightweight web-framework for creating real-time app

Dec 28, 2022

A TypeScript/JavaScript library for working with ASN, IPv4, and IPv6 numbers. It provides representations of these internet protocol numbers with the ability to perform various IP related operations like parsing, validating etc. on them

A TypeScript/JavaScript library for working with ASN, IPv4, and IPv6 numbers. It provides representations of these internet protocol numbers with the ability to perform various IP related operations like parsing, validating etc. on them

ip-num ip-num is a TypeScript library for working with IPv4, IPv6 and ASN numbers. It provides representations of these internet protocol numbers with

Dec 8, 2022

Semi-embedded JS template engine that supports helpers, filters, partials, and template inheritance. 4KB minzipped, written in TypeScript ⛺

Semi-embedded JS template engine that supports helpers, filters, partials, and template inheritance. 4KB minzipped, written in TypeScript ⛺

squirrelly Documentation - Chat - RunKit Demo - Playground Summary Squirrelly is a modern, configurable, and blazing fast template engine implemented

Jan 2, 2023

Embedded JS template engine for Node, Deno, and the browser. Lighweight, fast, and pluggable. Written in TypeScript

Embedded JS template engine for Node, Deno, and the browser. Lighweight, fast, and pluggable. Written in TypeScript

eta (η) Documentation - Chat - RunKit Demo - Playground Summary Eta is a lightweight and blazing fast embedded JS templating engine that works inside

Dec 29, 2022

This project contains the TypeScript definitions for the Bing Maps V8 Web Control.

This project contains the TypeScript definitions for the Bing Maps V8 Web Control.

Bing Maps V8 TypeScript Definitions These are the official TypeScript definitions for the Bing Maps V8 Web Control. These can be used to provide intel

Nov 23, 2022

A progressive Node.js framework for building efficient, scalable, and enterprise-grade server-side applications on top of TypeScript & JavaScript (ES6, ES7, ES8) 🚀

A progressive Node.js framework for building efficient, scalable, and enterprise-grade server-side applications on top of TypeScript & JavaScript (ES6, ES7, ES8) 🚀

A progressive Node.js framework for building efficient and scalable server-side applications. Description Nest is a framework for building efficient,

Dec 31, 2022

A framework for real-time applications and REST APIs with JavaScript and TypeScript

A framework for real-time applications and REST APIs with JavaScript and TypeScript

A framework for real-time applications and REST APIs with JavaScript and TypeScript Feathers is a lightweight web-framework for creating real-time app

Jan 1, 2023
Owner
wang.haoyu
Web Frontend Engineer
wang.haoyu
:books: The definitive guide to TypeScript and possibly the best TypeScript book :book:. Free and Open Source 🌹

TypeScript Deep Dive I've been looking at the issues that turn up commonly when people start using TypeScript. This is based on the lessons from Stack

Basarat Ali Syed 18.7k Jan 4, 2023
Companion React+TypeScript code for my Intro to TypeScript EmergentWorks workshop, bootstrapped with yarn + create-react-app! ✨

Getting Started with Create React App This project was bootstrapped with Create React App. Companion repository to https://github.com/JoshuaKGoldberg/

Josh Goldberg 2 Dec 21, 2022
Variant types in Roblox TypeScript - Ported from Vanilla TypeScript

Variant (for Roblox) This is a roblox typescript variant (heh, pun) of Variant. See the Variant documentation on how to use Variant. A variant type is

Australis 2 Jun 3, 2022
A Lua plugin, written in TypeScript, to write TypeScript (Lua optional).

typescript.nvim A minimal typescript-language-server integration plugin to set up the language server via nvim-lspconfig and add commands for convenie

Jose Alvarez 315 Dec 29, 2022
typescript-to-jsonschema generates JSON Schema files from your Typescript sources.

fast-typescript-to-jsonschema English | 简体中文 a tool generate json schema from typescript. Feature compile Typescript to get all type information conve

yunfly 21 Nov 28, 2022
Convert some JavaScript/TypeScript code string into a .d.ts TypeScript Declaration code string

convert-to-dts Converts the source code for any .js or .ts file into the equivalent .d.ts code TypeScript would generate. Usage import { convertToDecl

Lily Scott 11 Mar 3, 2022
Screeps Typescript Starter is a starting point for a Screeps AI written in Typescript.

Screeps Typescript Starter Screeps Typescript Starter is a starting point for a Screeps AI written in Typescript. It provides everything you need to s

null 3 Jan 27, 2022
Movehat is a TypeScript SDK for Move on Sui built on top of Sui's TypeScript SDK and our fork of Ian Macalinao's `move-ts`.

Movehat Movehat is a TypeScript SDK for Move on Sui built on top of Sui's TypeScript SDK and our fork of Ian Macalinao's move-ts. Movehat aspires to b

Pentagon 10 Sep 30, 2022
🐬 A simplified implementation of TypeScript's type system written in TypeScript's type system

?? HypeScript Introduction This is a simplified implementation of TypeScript's type system that's written in TypeScript's type annotations. This means

Ronen Amiel 1.8k Dec 20, 2022
A CLI tool to create a NodeJS project with TypeScript CTSP is a CLI tool to make easier to start a new NodeJS project and configure Typescript on it.

CTSP- Create TS Project A CLI tool to create a NodeJS project with TypeScript CTSP is a CLI tool to make easier to start a new NodeJS project and conf

Jean Rodríguez 7 Sep 13, 2022