Skip to content

Commit f1b6134

Browse files
committed
feat: add react project
1 parent f09c7ea commit f1b6134

File tree

1,269 files changed

+65564
-30866
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,269 files changed

+65564
-30866
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ node_modules
22
build
33
.next
44
.parcel-cache
5+
.idea
56
dist
67
dist-parcel
78
dist-esbuild
@@ -12,3 +13,4 @@ dist-snowpack
1213
dist-rsbuild
1314
esbuild-serve
1415
next-env.d.ts
16+
/packages/projects/**/dist-*

LICENSE

Lines changed: 0 additions & 21 deletions
This file was deleted.

benchmark/esbuild.mjs

Lines changed: 0 additions & 70 deletions
This file was deleted.

esbuild-public/index.html

Lines changed: 0 additions & 11 deletions
This file was deleted.

farm.config.ts

Lines changed: 0 additions & 31 deletions
This file was deleted.

next.config.js

Lines changed: 0 additions & 6 deletions
This file was deleted.

package.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,5 +84,8 @@
8484
},
8585
"alias": {
8686
"process": false
87-
}
87+
},
88+
"workspaces": [
89+
"packages/*"
90+
]
8891
}
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
import type {UserConfig} from '@farmfe/core'
2+
3+
const env = process.env.NODE_ENV;
4+
const isProdMode = env === 'production';
5+
6+
const config: UserConfig = {
7+
compilation: {
8+
input: {
9+
index: './index.html',
10+
},
11+
resolve: {
12+
symlinks: true,
13+
mainFields: ['module', 'main', 'customMain'],
14+
extensions: ['tsx', 'jsx', 'ts', 'js', 'json']
15+
},
16+
output: {
17+
path: './dist-farm',
18+
},
19+
sourcemap: !isProdMode,
20+
presetEnv: {
21+
options: {
22+
targets: 'Chrome >= 87, Firefox >= 78, Safari >= 14, Edge >= 88'
23+
}
24+
}
25+
},
26+
server: {
27+
strictPort: true,
28+
hmr: true
29+
},
30+
plugins: ['@farmfe/plugin-react'],
31+
};
32+
export default config
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<!doctype html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8" />
5+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
6+
<title>Vite + React + TS</title>
7+
</head>
8+
<body>
9+
<div id="root"></div>
10+
<script type="module" src="main.js"></script>
11+
</body>
12+
</html>
13+

packages/projects/react/index.html

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<!doctype html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8" />
5+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
6+
<title>Vite + React + TS</title>
7+
</head>
8+
<body>
9+
<div id="root"></div>
10+
<script type="module" src="./src/main.tsx"></script>
11+
</body>
12+
</html>
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<!doctype html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8" />
5+
<link rel="icon" type="image/svg+xml" href="../public/vite.svg" />
6+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
7+
<title>Vite + React + TS</title>
8+
</head>
9+
<body>
10+
<div id="root"></div>
11+
<script type="module" src="main.js"></script>
12+
</body>
13+
</html>
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<!doctype html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8" />
5+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
6+
<title>Vite + React + TS</title>
7+
</head>
8+
<body>
9+
<div id="root"></div>
10+
</body>
11+
</html>
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
const nextConfig = {
2+
distDir: 'dist-turbopack'
3+
}
4+
export default nextConfig;

packages/projects/react/package.json

Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
{
2+
"name": "js-bundler-project-react-demo",
3+
"private": true,
4+
"version": "0.0.0",
5+
"type": "module",
6+
"scripts": {
7+
"start:vite": "cross-env NODE_ENV=development vite",
8+
"start:vite-swc": "cross-env NODE_ENV=development vite -c vite.swc.config.ts",
9+
"start:webpack": "cross-env NODE_ENV=development webpack serve",
10+
"start:webpack-swc": "cross-env NODE_ENV=development webpack serve --config webpack.swc.config.mjs",
11+
"start:rspack": "cross-env NODE_ENV=development rspack serve",
12+
"start:rspack-swc": "cross-env NODE_ENV=development rspack serve --config rspack.swc.config.mjs",
13+
"start:turbopack": "cross-env NODE_ENV=development next dev --turbo -p 3000",
14+
"start:farm": "cross-env NODE_ENV=development farm start",
15+
"start:esbuild": "cross-env NODE_ENV=development node ../tools/esbuild.mjs --watch --outputDir=react/dist-esbuild --entry=react/src/main.tsx",
16+
"start:parcel": "cross-env NODE_ENV=development parcel index.html --dist-dir dist-parcel",
17+
"start:snowpack": "cross-env NODE_ENV=development snowpack dev",
18+
"start:rsbuild": "cross-env NODE_ENV=development rsbuild dev",
19+
"start:rollup": "cross-env NODE_ENV=development rollup -c --watch",
20+
21+
"build:vite": "cross-env NODE_ENV=production vite build",
22+
"build:vite-swc": "cross-env NODE_ENV=production vite build -c vite.swc.config.ts",
23+
"build:webpack": "cross-env NODE_ENV=production webpack build",
24+
"build:webpack-swc": "cross-env NODE_ENV=production webpack build --config webpack.swc.config.mjs --mode production",
25+
"build:rspack": "cross-env NODE_ENV=production rspack build",
26+
"build:rspack-swc": "cross-env NODE_ENV=production rspack build --config rspack.swc.config.mjs",
27+
"build:turbopack": "cross-env NODE_ENV=production next build",
28+
"build:farm": "cross-env NODE_ENV=production farm build",
29+
"build:esbuild": "cross-env NODE_ENV=production esbuild src/main.tsx --bundle --minify --target=chrome87,firefox78,safari14,edge88 --outdir=dist-esbuild",
30+
"build:parcel": "cross-env NODE_ENV=production parcel build index.html --dist-dir dist-parcel --no-source-maps --no-cache",
31+
"build:snowpack": "cross-env NODE_ENV=production snowpack build",
32+
"build:rsbuild": "cross-env NODE_ENV=production rsbuild build",
33+
"build:rollup": "cross-env NODE_ENV=production rollup -c",
34+
"lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
35+
"preview": "vite preview"
36+
},
37+
"dependencies": {
38+
"react": "^18.2.0",
39+
"react-dom": "^18.2.0"
40+
},
41+
"devDependencies": {
42+
"@babel/core": "^7.23.7",
43+
"@babel/preset-env": "^7.23.8",
44+
"@babel/preset-react": "^7.23.3",
45+
"@babel/preset-typescript": "^7.23.3",
46+
"@farmfe/cli": "^0.5.11",
47+
"@farmfe/core": "^0.14.12",
48+
"@farmfe/plugin-react": "^0.4.3",
49+
"@pmmmwh/react-refresh-webpack-plugin": "^0.5.11",
50+
"@rollup/plugin-babel": "^6.0.4",
51+
"@rollup/plugin-commonjs": "^25.0.7",
52+
"@rollup/plugin-node-resolve": "^15.2.3",
53+
"@rollup/plugin-replace": "^5.0.5",
54+
"@rsbuild/core": "^0.3.5",
55+
"@rsbuild/plugin-react": "^0.3.5",
56+
"@rspack/cli": "^0.5.1",
57+
"@rspack/core": "^0.5.1",
58+
"@rspack/plugin-react-refresh": "^0.5.1",
59+
"@snowpack/plugin-react-refresh": "^2.5.0",
60+
"@types/node": "^18.19.3",
61+
"@types/react": "^18.2.43",
62+
"@types/react-dom": "^18.2.17",
63+
"@typescript-eslint/eslint-plugin": "^6.14.0",
64+
"@typescript-eslint/parser": "^6.14.0",
65+
"@vitejs/plugin-react": "^4.2.1",
66+
"@vitejs/plugin-react-swc": "^3.5.0",
67+
"babel-loader": "^9.1.3",
68+
"cross-env": "^7.0.3",
69+
"css-loader": "^6.9.1",
70+
"esbuild": "^0.19.11",
71+
"eslint": "^8.55.0",
72+
"eslint-plugin-react-hooks": "^4.6.0",
73+
"eslint-plugin-react-refresh": "^0.4.5",
74+
"html-webpack-plugin": "^5.6.0",
75+
"next": "^14.1.0",
76+
"parcel": "^2.11.0",
77+
"process": "^0.11.10",
78+
"react-refresh": "^0.14.0",
79+
"repack": "^0.0.1",
80+
"rollup": "^4.9.6",
81+
"rollup-plugin-postcss": "^4.0.2",
82+
"rollup-plugin-server": "^0.7.0",
83+
"rollup-plugin-typescript2": "^0.36.0",
84+
"snowpack": "^3.8.8",
85+
"style-loader": "^3.3.4",
86+
"swc-loader": "^0.2.3",
87+
"typescript": "^5.2.2",
88+
"vite": "^5.0.8",
89+
"vue": "^3.4.15",
90+
"webpack": "^5.89.0",
91+
"webpack-cli": "^5.1.4",
92+
"webpack-dev-server": "^4.15.1"
93+
},
94+
"browserslist": [
95+
"Chrome >= 87, Firefox >= 78, Safari >= 14, Edge >= 88"
96+
]
97+
}

0 commit comments

Comments
 (0)