Skip to content

Commit 05a153e

Browse files
committed
first commit
1 parent 04291ff commit 05a153e

8 files changed

+19417
-0
lines changed

.gitignore

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# dependencies
2+
/node_modules
3+
/.pnp
4+
.pnp.js
5+
6+
# testing
7+
/coverage
8+
9+
# production
10+
/build
11+
12+
# misc
13+
.DS_Store
14+
.env.local
15+
.env.development.local
16+
.env.test.local
17+
.env.production.local
18+
19+
npm-debug.log*
20+
yarn-debug.log*
21+
yarn-error.log*

package-lock.json

Lines changed: 19212 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
{
2+
"name": "my-app",
3+
"version": "0.0.1",
4+
"scripts": {
5+
"start": "webpack serve --config webpack.dev.config.ts",
6+
"build": "webpack --config webpack.prod.config.ts"
7+
},
8+
"dependencies": {
9+
"react": "^17.0.1",
10+
"react-dom": "^17.0.1"
11+
},
12+
"devDependencies": {
13+
"@babel/core": "^7.12.10",
14+
"@babel/plugin-transform-runtime": "^7.12.10",
15+
"@babel/preset-env": "^7.12.11",
16+
"@babel/preset-react": "^7.12.10",
17+
"@babel/preset-typescript": "^7.12.7",
18+
"@babel/runtime": "^7.12.5",
19+
"@types/fork-ts-checker-webpack-plugin": "^0.4.5",
20+
"@types/react": "^17.0.0",
21+
"@types/react-dom": "^17.0.0",
22+
"@types/webpack": "^4.41.25",
23+
"@types/webpack-dev-server": "^3.11.1",
24+
"@typescript-eslint/eslint-plugin": "^4.11.1",
25+
"@typescript-eslint/parser": "^4.11.1",
26+
"babel-loader": "^8.2.2",
27+
"clean-webpack-plugin": "^3.0.0",
28+
"eslint": "^7.17.0",
29+
"eslint-plugin-react": "^7.22.0",
30+
"eslint-plugin-react-hooks": "^4.2.0",
31+
"eslint-webpack-plugin": "^2.4.1",
32+
"fork-ts-checker-webpack-plugin": "^6.0.8",
33+
"html-webpack-plugin": "^4.5.1",
34+
"ts-node": "^9.1.1",
35+
"typescript": "^4.1.3",
36+
"webpack": "^5.11.1",
37+
"webpack-cli": "^4.3.1",
38+
"webpack-dev-server": "^3.11.1"
39+
}
40+
}

src/index.html

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<meta charset="utf-8" />
5+
<title>My app</title>
6+
</head>
7+
<body>
8+
<div id="root"></div>
9+
</body>
10+
</html>

src/index.tsx

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import React from "react";
2+
import ReactDOM from "react-dom";
3+
4+
const App = () => (
5+
<h1>My React and TypeScript App!! {new Date().toLocaleDateString()}</h1>
6+
);
7+
8+
ReactDOM.render(
9+
<React.StrictMode>
10+
<App />
11+
</React.StrictMode>,
12+
document.getElementById("root")
13+
);

tsconfig.json

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"compilerOptions": {
3+
"lib": ["dom", "dom.iterable", "esnext"],
4+
"allowJs": true,
5+
"allowSyntheticDefaultImports": true,
6+
"skipLibCheck": true,
7+
"esModuleInterop": true,
8+
"strict": true,
9+
"forceConsistentCasingInFileNames": true,
10+
"moduleResolution": "node",
11+
"resolveJsonModule": true,
12+
"isolatedModules": true,
13+
"noEmit": true,
14+
"jsx": "react"
15+
},
16+
"include": ["src"]
17+
}

webpack.dev.config.ts

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
import path from "path";
2+
import webpack from "webpack";
3+
import HtmlWebpackPlugin from "html-webpack-plugin";
4+
import ForkTsCheckerWebpackPlugin from "fork-ts-checker-webpack-plugin";
5+
import ESLintPlugin from "eslint-webpack-plugin";
6+
7+
const config: webpack.Configuration = {
8+
mode: "development",
9+
entry: "./src/index.tsx",
10+
module: {
11+
rules: [
12+
{
13+
test: /\.(ts|js)x?$/i,
14+
exclude: /node_modules/,
15+
use: {
16+
loader: "babel-loader",
17+
options: {
18+
presets: [
19+
"@babel/preset-env",
20+
"@babel/preset-react",
21+
"@babel/preset-typescript",
22+
],
23+
},
24+
},
25+
},
26+
],
27+
},
28+
resolve: {
29+
extensions: [".tsx", ".ts", ".js"],
30+
},
31+
plugins: [
32+
new HtmlWebpackPlugin({
33+
template: "src/index.html",
34+
}),
35+
new webpack.HotModuleReplacementPlugin(),
36+
new ForkTsCheckerWebpackPlugin({
37+
async: false,
38+
}),
39+
new ESLintPlugin({
40+
extensions: ["js", "jsx", "ts", "tsx"],
41+
}),
42+
],
43+
devtool: "inline-source-map",
44+
devServer: {
45+
contentBase: path.join(__dirname, "build"),
46+
historyApiFallback: true,
47+
port: 4000,
48+
open: true,
49+
hot: true,
50+
},
51+
};
52+
53+
export default config;

webpack.prod.config.ts

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
import path from "path";
2+
import webpack from "webpack";
3+
import HtmlWebpackPlugin from "html-webpack-plugin";
4+
import ForkTsCheckerWebpackPlugin from "fork-ts-checker-webpack-plugin";
5+
import ESLintPlugin from "eslint-webpack-plugin";
6+
import { CleanWebpackPlugin } from "clean-webpack-plugin";
7+
8+
const config: webpack.Configuration = {
9+
mode: "production",
10+
entry: "./src/index.tsx",
11+
output: {
12+
path: path.resolve(__dirname, "build"),
13+
filename: "[name].[contenthash].js",
14+
publicPath: "",
15+
},
16+
module: {
17+
rules: [
18+
{
19+
test: /\.(ts|js)x?$/i,
20+
exclude: /node_modules/,
21+
use: {
22+
loader: "babel-loader",
23+
options: {
24+
presets: [
25+
"@babel/preset-env",
26+
"@babel/preset-react",
27+
"@babel/preset-typescript",
28+
],
29+
},
30+
},
31+
},
32+
],
33+
},
34+
resolve: {
35+
extensions: [".tsx", ".ts", ".js"],
36+
},
37+
plugins: [
38+
new HtmlWebpackPlugin({
39+
template: "src/index.html",
40+
}),
41+
new ForkTsCheckerWebpackPlugin({
42+
async: false,
43+
}),
44+
new ESLintPlugin({
45+
extensions: ["js", "jsx", "ts", "tsx"],
46+
}),
47+
new CleanWebpackPlugin(),
48+
],
49+
};
50+
51+
export default config;

0 commit comments

Comments
 (0)