GithubHelp home page GithubHelp logo

webpack5-react18-ts's Introduction

配置 webpack5-React18+TS 开发打包环境及其优化

项目内所示目录结构和文件

|---public
|       favicon.ico 
|       index.html # html模板
|       
+---src
|   |   App.tsx
|   |   images.d.ts 
|   |   index.tsx # 入口文件
|   |   style.css 
|   |   style.less
|   |   
|   +---assets
|   |   \---imgs
|   |           22kb.webp
|   |           5kb.webp
|   |           
|   \---components
|           Class.tsx # 装饰器测试
|           index.ts # ES6+语法测试
|           LazyDemo.tsx # 懒加载测试
|           PreFetchDemo.tsx # 资源预加载
|           PreloadDemo.tsx # 资源预加载
|           
+---webpack
|       paths.js # 常用公共路径
|       proxy.js # 前端代理解决跨域
|       rules.js # 模块处理规则
|       webpack.base.js # 公共配置
|       webpack.dev.js # 开发环境配置
|       webpack.prod.js # 打包环境配置
|       webpack.speed.js # webpack构建分析配置
|       
|   .browserslistrc # 浏览器兼容清单
|   .env
|   .eslintignore
|   .eslintrc.json # eslintrc配置
|   .gitignore
|   babel.config.js # babel配置
|   package.json
|   postcss.config.js # postcss配置
|   README.md
|   tailwind.config.js # tailwind配置
|   tsconfig.json # ts配置
  1. 安装依赖
pnpm i
npm i
  1. 开发环境运行
pnpm dev
npm run dev
  1. 生产环境打包
pnpm build
npm run build
  1. webpack打包分析
pnpm speed
npm run speed

各文件中都有详细注释

webpack各项配置说明和插件功能都有相关注释,可以按照自己的需要进行修改,也可以直接使用完全ok!

webpack5-react18-ts's People

Contributors

relsola avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.