Skip to content

Commit 1f93a9a

Browse files
committed
增加React-typescript项目
1 parent 81ad4af commit 1f93a9a

File tree

14 files changed

+292
-0
lines changed

14 files changed

+292
-0
lines changed

note.md

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
组件化
2+
3+
性能优化:
4+
* webpack缓存压缩分包Tree Shaking
5+
* webpack 组件动态加载,公共资源打包
6+
* DOM数量控制
7+
* CSS GPU加速, CSS Matrix
8+
* 前端性能监控,通过可视化图表展示性能指标数据
9+
* FCP/FMP
10+
* sdk
11+
* 减少首屏时间:
12+
* 利用浏览器缓存策略缓存静态资源,异步import模块减少首屏js体积
13+
* 在webpack中配置首屏预渲染内容。前置SPA应用FCP时间
14+
* React的state批处理,PureComponent,memo减少组件不必要的更新渲染
15+
16+
React:
17+
* 源码
18+
* 使用hook函数式组件构建通用组件(form,table)
19+
* 自定义hook(request,节流函数)提升团队开发效率
20+
* React 同构
21+
22+
CI/CD
23+
24+
单元测试
25+
26+
eslint配置
27+
28+
babel配置
29+
30+
脚手架
31+
对vue-cli做二次封装
32+
33+
pm2
34+
35+
CSS:
36+
* BEM+原子CSS命名规范,规范化开发
37+
* css-houdini
38+
* next
39+
* 矩阵
40+
41+
V8
42+
* 快属性 慢属性
43+
44+
node中间层,接口的削减
45+
46+
koa:
47+
* 搭建中间层
48+
* 洋葱模型
49+
50+
typescript:
51+
* vue组件,简单的语法
52+
53+
网络协议:
54+
* TCP/IP
55+
* HTTP
56+
* HTTP2
57+
58+
技术栈:sdk + rollup + FCP/FMP
59+
60+
new Vue({})为什么属性越多越慢?
61+
V8快属性,慢属性 -> 词法解析,语法解析 -> ast -> 字节码 -> ao vo go -> 收集代码信息 -> 优化字节码 生成机器码
62+
63+
工程化: CI/CD webpack原理 webpack5工程化
64+
65+
前端安全:xss csrf webshell 劫持 beem 中国菜刀 web渗透
66+
67+
webpack集群编译
68+
69+
types-react
70+
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
const {join} = require('path')
2+
var FriendlyErrorsWebpackPlugin = require('friendly-errors-webpack-plugin');
3+
const WebpackBuildNotifierPlugin = require('webpack-build-notifier');
4+
5+
6+
module.exports = {
7+
devServer:{
8+
contentBase:join(__dirname, "../dist"),
9+
hot:true,
10+
quiet:true,
11+
historyApiFallback:true,
12+
},
13+
plugins: [
14+
new FriendlyErrorsWebpackPlugin({
15+
compilationSuccessInfo: {
16+
messages: ['You application is running here http://localhost:3000'],
17+
notes: ['Some additionnal notes to be displayed unpon successful compilation']
18+
},
19+
onErrors: function (severity, errors) {
20+
// You can listen to errors transformed and prioritized by the plugin
21+
// severity can be 'error' or 'warning'
22+
},
23+
clearConsole:true
24+
}),
25+
new WebpackBuildNotifierPlugin({
26+
title: "My Webpack Project",
27+
suppressSuccess: true, // don't spam success notifications
28+
})
29+
],
30+
}

src/project/dist/main.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
/*
2+
* ATTENTION: The "eval" devtool has been used (maybe by default in mode: "development").
3+
* This devtool is neither made for production nor for readable output files.
4+
* It uses "eval()" calls to create a separate source file in the browser devtools.
5+
* If you are trying to read the output file, select a different devtool (https://webpack.js.org/configuration/devtool/)
6+
* or disable the default devtool with "devtool: false".
7+
* If you are looking for production-ready output files, see mode: "production" (https://webpack.js.org/configuration/mode/).
8+
*/
9+
/******/ (() => { // webpackBootstrap
10+
/******/ "use strict";
11+
/******/
12+
/******/
13+
/******/ })()
14+
;

src/project/package.json

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
{
2+
"name": "project",
3+
"version": "1.0.0",
4+
"description": "",
5+
"main": "index.js",
6+
"path": ".",
7+
"scripts": {
8+
"dev": "echo 111",
9+
"test": "echo 222",
10+
"start": "npm run dev && npm run test",
11+
"start2": "npm run dev & npm run test",
12+
"client:dev": "scripty",
13+
"client:server": "scripty"
14+
},
15+
"keywords": [],
16+
"author": "",
17+
"license": "ISC",
18+
"dependencies": {
19+
"react": "^17.0.2",
20+
"react-dom": "^17.0.2",
21+
"react-router": "^5.2.0",
22+
"scripty": "^2.0.0",
23+
"yargs-parser": "^20.2.9"
24+
},
25+
"devDependencies": {
26+
"@nuxtjs/friendly-errors-webpack-plugin": "^2.1.0",
27+
"awesome-typescript-loader": "^5.2.1",
28+
"friendly-errors-webpack-plugin": "^1.7.0",
29+
"html-webpack-plugin": "^5.3.2",
30+
"webpack": "^5.45.1",
31+
"webpack-build-notifier": "^2.3.0",
32+
"webpack-cli": "^4.7.2",
33+
"webpack-merge": "^5.8.0"
34+
}
35+
}

src/project/scripts/client/dev.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
#webpack 开发
2+
webpack --mode development

src/project/scripts/client/prod.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# webpack 上线
2+
webpack --mode production

src/project/scripts/client/server.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
#本地的开发环境
2+
webpack-dev-server --mode development --open
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import * as React from 'react'
2+
3+
const Home = ()=>{
4+
return (
5+
<div>基础的Home组件
6+
</div>
7+
)
8+
}
9+
10+
export default Home

src/project/src/web/index.html

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<title>单页开发环境</title>
6+
</head>
7+
<body>
8+
<div id="main"></div>
9+
<style>
10+
:root {
11+
--bgColor:yellow
12+
--x:()=>{console.log(12)}
13+
}
14+
body{
15+
--bodyBgColor:black
16+
background:var(--bodyBgColor)
17+
}
18+
span{
19+
color: var(--bgColor)
20+
}
21+
</style>
22+
</body>
23+
</html>

src/project/src/web/index.tsx

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
// interface Person {
2+
// str:string
3+
// }
4+
//
5+
// class Index {
6+
// private data:Person;
7+
//
8+
// constructor(data:Person) {
9+
// this.data = data
10+
// }
11+
//
12+
// log(){
13+
// console.log(this.data)
14+
// }
15+
// }
16+
17+
import * as React from 'react'
18+
import * as ReactDom from 'react-dom'
19+
20+
import App from './pages/App'
21+
ReactDom.renser(<APP/>,document.getElementById('main'))

0 commit comments

Comments
 (0)