|
1 | | -# react-webpack-configuration |
| 1 | +# Welcome to the Ultimate React App Creation Guide with Webpack 5! 🚀 |
2 | 2 |
|
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. |
4 | 4 |
|
5 | | -## Installation |
| 5 | +## Why You'll Love This Repository: 🎉 |
6 | 6 |
|
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! |
8 | 8 |
|
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. |
13 | 10 |
|
| 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. |
14 | 12 |
|
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. |
19 | 14 |
|
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! |
21 | 16 |
|
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. |
43 | 18 |
|
| 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. |
44 | 20 |
|
45 | | -4. Generate a TypeScript configuration file: |
46 | | -```bash |
47 | | - tsc --init |
48 | | -``` |
| 21 | +## Get Started Today! 🌟 |
49 | 22 |
|
| 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. |
50 | 24 |
|
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] |
55 | 26 |
|
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. |
57 | 28 |
|
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