Skip to content

Commit 04717dc

Browse files
committed
2 parents f1fdb88 + 6c4c1ec commit 04717dc

File tree

2 files changed

+43
-189
lines changed

2 files changed

+43
-189
lines changed

.github/workflows/webpack.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: NodeJS with Webpack
2+
3+
on:
4+
push:
5+
branches: [ "main" ]
6+
pull_request:
7+
branches: [ "main" ]
8+
9+
jobs:
10+
build:
11+
runs-on: ubuntu-latest
12+
13+
strategy:
14+
matrix:
15+
node-version: [14.x, 16.x, 18.x]
16+
17+
steps:
18+
- uses: actions/checkout@v3
19+
20+
- name: Use Node.js ${{ matrix.node-version }}
21+
uses: actions/setup-node@v3
22+
with:
23+
node-version: ${{ matrix.node-version }}
24+
25+
- name: Build
26+
run: |
27+
npm install
28+
npx webpack

README.md

Lines changed: 15 additions & 189 deletions
Original file line numberDiff line numberDiff line change
@@ -1,203 +1,29 @@
1-
# react-webpack-configuration
1+
# Welcome to the Ultimate React App Creation Guide with Webpack 5! 🚀
22

3-
This repository provides a basic setup for a React project using webpack.
3+
Are you ready to embark on an exciting journey into the world of modern web development? 🌐✨ Whether you're a seasoned coder or just taking your first steps, our carefully crafted sample repository is here to be your trusty guide in creating your very own React app using the powerful Webpack 5 compiler and all the necessary packages.
44

5-
## Installation
5+
## Why You'll Love This Repository: 🎉
66

7-
1. Create a new folder:
7+
- **Step-by-Step Simplicity:** We believe in learning by doing, and that's why we've broken down the process into easy-to-follow steps. No overwhelming tech jargon – just clear instructions!
88

9-
```bash
10-
npm install my-project
11-
cd my-project
12-
```
9+
- **Webpack 5 Magic:** Discover the magic of Webpack 5 – the latest and greatest version of the popular bundler. It optimizes your code for performance, so your app loads faster than ever before.
1310

11+
- **React Brilliance:** Dive deep into the world of React – the dynamic JavaScript library that powers some of the most impressive web applications. From components to states, you'll grasp it all.
1412

15-
2. Initialize a new npm project:
16-
```bash
17-
yarn init -y
18-
```
13+
- **Package Playground:** Explore the essential packages that make your app come to life! Routing with React Router, styling with CSS Modules, and more – it's like a treasure trove of web development gems.
1914

20-
3. Install the dependencies using yarn or npm
15+
- **Responsive Design:** Learn how to create apps that look amazing on every device. Mobile, tablet, desktop – your app will shine everywhere!
2116

22-
```bash
23-
"@babel/core": "^7.22.5",
24-
"@babel/preset-env": "^7.22.5",
25-
"@babel/preset-react": "^7.22.5",
26-
"@babel/preset-typescript": "^7.22.5",
27-
"@types/react": "^18.2.13",
28-
"@types/react-dom": "^18.2.6",
29-
"babel-loader": "^9.1.2",
30-
"css-loader": "^6.8.1",
31-
"dotenv": "^16.3.1",
32-
"html-webpack-plugin": "^5.5.3",
33-
"process": "^0.11.10",
34-
"react": "^18.2.0",
35-
"react-dom": "^18.2.0",
36-
"style-loader": "^3.3.3",
37-
"ts-loader": "^9.4.3",
38-
"typescript": "^5.1.3",
39-
"webpack": "^5.88.0",
40-
"webpack-cli": "^5.1.4",
41-
"webpack-dev-server": "^4.15.1"
42-
```
17+
- **Interactive Examples:** Don't just read about it – see it in action! Interactive code examples help you understand concepts better and make learning an enjoyable experience.
4318

19+
- **Community and Support:** Join a community of fellow learners! Got questions? We've got answers. Share your progress, exchange ideas, and feel the energy of collective learning.
4420

45-
4. Generate a TypeScript configuration file:
46-
```bash
47-
tsc --init
48-
```
21+
## Get Started Today! 🌟
4922

23+
Ready to dive in? Simply clone our repository and follow along with the guided instructions in each section. Before you know it, you'll have a stunning, fully-functional React app under your belt, and a newfound confidence in using Webpack 5.
5024

51-
5. Open the `tsconfig.json` file and uncomment the line
52-
```bash
53-
"jsx": "preserve"
54-
```
25+
**Repository Link:** [https://github.com/deepumandal/react-webpack-configuration]
5526

56-
6. Create a new folder named `src` inside the my-project.
27+
Don't miss this opportunity to level up your web development skills. Whether you're looking to build your portfolio, start a new career, or simply enjoy the art of creating digital experiences, this repository has something exciting for everyone.
5728

58-
7. Create an `index.html` file inside the `src` folder and paste the following code:
59-
```html
60-
<!DOCTYPE html>
61-
<html lang="en">
62-
<head>
63-
<meta charset="UTF-8" />
64-
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
65-
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
66-
<title>Document</title>
67-
</head>
68-
<body>
69-
<div id="root"></div>
70-
</body>
71-
</html>
72-
```
73-
74-
8. Create an ```index.css``` file inside the src folder.
75-
76-
9. Create an ```index.tsx``` file inside the src folder and paste the following code:
77-
```html
78-
import React from "react";
79-
import ReactDOM from "react-dom";
80-
import App from "./App";
81-
import "./index.css";
82-
83-
ReactDOM.render(<App />, document.getElementById("root"));
84-
85-
```
86-
87-
10. Create an```App.tsx``` file inside the src folder and paste the following code:
88-
```html
89-
import React from 'react'
90-
91-
const App: React.FC = () => {
92-
return (
93-
<div>App</div>
94-
)
95-
}
96-
97-
export default App
98-
```
99-
100-
11. Create a webpack.config.js file in the main folder and paste the following code:
101-
102-
```html
103-
const path = require("path");
104-
const htmlWebpackPlugin = require("html-webpack-plugin");
105-
const webpack = require("webpack");
106-
107-
// dotenv configuration settings
108-
const dotenv = require("dotenv").config({ path: __dirname + "/.env" });
109-
const isProduction = process.env.NODE_ENV === "production";
110-
module.exports = {
111-
resolve: {
112-
extensions: [".js", ".jsx", ".ts", ".tsx"],
113-
},
114-
entry: "./src/index.tsx",
115-
output: {
116-
path: path.resolve(__dirname, "dist"),
117-
},
118-
plugins: [
119-
new htmlWebpackPlugin({
120-
template: "./src/index.html",
121-
}),
122-
new webpack.ProvidePlugin({
123-
process: "process/browser",
124-
}),
125-
new webpack.DefinePlugin({
126-
"process.env": JSON.stringify({
127-
...dotenv.parsed,
128-
NODE_ENV: JSON.stringify(isProduction ? "production" : "development"),
129-
}),
130-
}),
131-
],
132-
module: {
133-
rules: [
134-
{
135-
test: /.(js|jsx|ts|tsx)$/,
136-
exclude: /node_modules/,
137-
use: {
138-
loader: "babel-loader",
139-
options: {
140-
presets: [
141-
"@babel/preset-env",
142-
"@babel/preset-react",
143-
"@babel/preset-typescript",
144-
],
145-
},
146-
},
147-
},
148-
{
149-
test: /\.css$/,
150-
use: ["style-loader", "css-loader"],
151-
},
152-
],
153-
},
154-
devServer: {
155-
port: 7000,
156-
open: true,
157-
hot: true,
158-
},
159-
};
160-
```
161-
12. modify package.json
162-
``` html
163-
{
164-
"name": "my-project",
165-
"version": "1.0.0",
166-
"main": "index.js",
167-
"license": "MIT",
168-
"scripts": {
169-
"start": "webpack-dev-server --mode development --open --hot",
170-
"build": "webpack --mode production"
171-
},
172-
"dependencies": {
173-
"@babel/core": "^7.22.5",
174-
"@babel/preset-env": "^7.22.5",
175-
"@babel/preset-react": "^7.22.5",
176-
"@babel/preset-typescript": "^7.22.5",
177-
"@chakra-ui/react": "^2.7.1",
178-
"@emotion/styled": "^11.11.0",
179-
"@types/react": "^18.2.13",
180-
"@types/react-dom": "^18.2.6",
181-
"@types/react-router-dom": "^5.3.3",
182-
"babel-loader": "^9.1.2",
183-
"css-loader": "^6.8.1",
184-
"dotenv": "^16.3.1",
185-
"framer-motion": "^10.12.16",
186-
"html-webpack-plugin": "^5.5.3",
187-
"process": "^0.11.10",
188-
"react": "^18.2.0",
189-
"react-dom": "^18.2.0",
190-
"react-router-dom": "^6.13.0",
191-
"style-loader": "^3.3.3",
192-
"ts-loader": "^9.4.3",
193-
"typescript": "^5.1.3",
194-
"webpack": "^5.88.0",
195-
"webpack-cli": "^5.1.4",
196-
"webpack-dev-server": "^4.15.1"
197-
}
198-
}
199-
```
200-
201-
## Authors
202-
203-
- [@deepumandal](https://www.github.com/deepumandal)
29+
Let's code, innovate, and build the future together! 🖥️🌈

0 commit comments

Comments
 (0)