Тёмный

React Webpack Babel Setup From Scatch - 2020 React.js Tutorial 

LetsCode
Подписаться 2,9 тыс.
Просмотров 9 тыс.
50% 1

How to set up a complete React JS project from scratch. Using webpack and babel. I also show you how to add additional useful loaders such as file-loaders to import images, scss loaders to use scss and compile it into scss. I also show you how to make builds for multiple environment with environment variables.
Regex used in video:
/\.(js|jsx)$/
/\.html$/
/\.(png|jpe?g|gif)$/i
/\.s[ac]ss$/i
/\.(js|jsx|ts|tsx)$/
tsconfig.json file:
{
"compilerOptions": {
"target": "es5",
"sourceMap": true,
"lib": [
"dom",
"dom.iterable",
"esnext"
],
"allowJs": true,
"skipLibCheck": true,
"esModuleInterop": true,
"allowSyntheticDefaultImports": true,
"strict": true,
"forceConsistentCasingInFileNames": false,
"module": "esnext",
"moduleResolution": "node",
"resolveJsonModule": true,
"jsx": "react",
"removeComments": true
}
}
Github repo: github.com/dar...

Опубликовано:

 

28 сен 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 56   
@daliborpetric8288
@daliborpetric8288 3 года назад
You explained me in half hour better than several Udemy courses in 40hours :D keep it up man, fantastic!
@letscode7478
@letscode7478 3 года назад
Glad I could help!
@daliborpetric8288
@daliborpetric8288 3 года назад
@@letscode7478 Just had some issues with sass and css, it required resolve-url-loader", also im not shure does your example with that mini css plugin is minifying the css?
@letscode7478
@letscode7478 3 года назад
@@daliborpetric8288 The mini-css-extract-plugin doesn't minify the css it just separates it out into a css file.
@Seb16291629
@Seb16291629 3 года назад
Amazing yes. All I needed too . Well done
@happy-shorty
@happy-shorty 3 года назад
Subscribed. I like the way you teach.
@letscode7478
@letscode7478 3 года назад
Awesome, thank you!
@ankitmehrotra8519
@ankitmehrotra8519 3 года назад
Just simply Awesome..
@san-chil
@san-chil 3 года назад
Awesome time saver.
@lethalbryan9865
@lethalbryan9865 3 года назад
Great video! Really enjoyed it. When working with webpack: ^5.2.1, webpack-cli: ^4.1.0 and webpack-dev-server: ^3.11.0 you have to run your dev server via webpack serve instead of webpack-dev-server to avoid errors, dont know why
@letscode7478
@letscode7478 3 года назад
Thanks, not sure why those version of webpack don't work with the dev server but thanks for the info.
@tonyxavier3567
@tonyxavier3567 2 года назад
Messy webpack setup, was hoping to see more TS
@iamdhison
@iamdhison 3 года назад
Excellent demo and explanation
@letscode7478
@letscode7478 3 года назад
Glad it helped
@meisammofidi13
@meisammofidi13 3 года назад
It was an amazing and helpful tutorial. BTW, I'd like to see coding by VS Code please use it if you don't mind
@subirkumarsao
@subirkumarsao 3 года назад
Very useful video. Thank you so much.
@letscode7478
@letscode7478 3 года назад
Glad it was helpful!
@beckyb9215
@beckyb9215 3 года назад
Thanks man ! really helpfull. Can you explain why you are not using the style-loader?
@letscode7478
@letscode7478 3 года назад
The only reason I am not using a style loader in this video is just to show one possibility of having your CSS/SCSS outside of your JavaScript. You can of course still use style loader I was just trying to give an example of how customizable webpack is.
@ritwik5774
@ritwik5774 3 года назад
very helpful, thanks!
@letscode7478
@letscode7478 3 года назад
Glad it was helpful!
@ankitkumargautam2043
@ankitkumargautam2043 3 года назад
Great work
@letscode7478
@letscode7478 3 года назад
Thanks!
@maras3190
@maras3190 3 года назад
The best!
@augustosantos6860
@augustosantos6860 3 года назад
im still watching the video, but im wondering why are u installing react and react-dom as dev Dependencies?
@letscode7478
@letscode7478 3 года назад
Good question, that was actually a mistake. react and react-dom shouldn't be dev dependancies, I think I was just typing -D out of habit.
@hufuputchi
@hufuputchi 3 года назад
cool man thanks ..
@letscode7478
@letscode7478 3 года назад
No problem!
@mayowdev2769
@mayowdev2769 3 года назад
Error: Cannot find module 'webpack-cli/bin/config-yargs' solution: change the script "start": "webpack-dev-server" to "start": "webpack serve"
@letscode7478
@letscode7478 3 года назад
Thanks for finding that issue
@hufuputchi
@hufuputchi 3 года назад
I've found a workaround by downgrading the webpack-dev-server to 3.11
@ДмитрийЕльчищев-б5у
The best tutorial for Babel and Webpack config
@davidfromnorth7836
@davidfromnorth7836 4 года назад
great video!
@letscode7478
@letscode7478 4 года назад
Glad you enjoyed it!
@timzeynalov3537
@timzeynalov3537 2 года назад
LOL you can simplify your video by writing create-react app and save fucking 20 minutes
@33v4.
@33v4. 2 года назад
and you could save your time posting a video yourself instead of talking shit on someone else's video?
@mohhamad_alikute
@mohhamad_alikute 2 года назад
đỉnh
@kailashuniyal04
@kailashuniyal04 4 года назад
This channel content is very unique. Keep it up.
@letscode7478
@letscode7478 4 года назад
Thanks, will do!
@RedVelocityTV
@RedVelocityTV 4 года назад
Great stuff man looking forward to this a
@letscode7478
@letscode7478 4 года назад
Great to hear! Hope you find it helpful.
@anastasiosarvanitis9533
@anastasiosarvanitis9533 3 года назад
This is THE BEST reactjs webpack babel configuration tutorial that I 've watched on youtube!!!! Thank you so much dude :D
@letscode7478
@letscode7478 3 года назад
Thanks really appreciate it!
@anastasiosarvanitis9533
@anastasiosarvanitis9533 3 года назад
@@letscode7478 by the way I ve tryed to build with react router and the routing in the build does not work all though it's working fine in development. Any ideas? I guess it should be webpak :)
@letscode7478
@letscode7478 3 года назад
I'm assuming that after you built it you opened the index.html file. That probably wont work. You will need actually start a server. To do this run "npm I -g serve" this will install this npm package www.npmjs.com/package/serve. Then to serve the build just run this command in your terminal "serve " where build folder name is what you set your build folder to be called. Then in the terminal you will see something like "Accepting connections on localhost:5000" just go to localhost:5000 and your build should be there. Another point that I forgot to mention in the video was publicPath: "/" not sure if this will affect the build, example output: { path: path.resolve(__dirname, "build"), filename: "bundle.js", publicPath: "/" }, Hope that helps
@anastasiosarvanitis9533
@anastasiosarvanitis9533 3 года назад
@@letscode7478 ok thank you so much for your answer, I will try and I will let you know!!! 😊
@anastasiosarvanitis9533
@anastasiosarvanitis9533 3 года назад
Yes it was that haha I am so stupid!!! Thanx again!!!!!!!
@pandjiasmoroart2257
@pandjiasmoroart2257 3 года назад
Thanks, great video
@david2am
@david2am 3 года назад
The best tutorial for Babel and Webpack config. Thanks!
@letscode7478
@letscode7478 3 года назад
Glad you like it!
@mihaimyh
@mihaimyh 4 года назад
Really good content here, I am glad I found your channel. I am new in FrontEnd development, can you, please explain, how is this different then creating a React project using create-react-app?
@letscode7478
@letscode7478 4 года назад
create-react-app sets up the entire environment for you, it handles the webpack configuration, the babel presets, loaders etc. Which is good for getting started since you dont have to concern yourself with this. However purpose of doing this from scratch is the customization that you have. You can chose what sort of loaders you want to use, how your files are built and where, what babel presets you want to you, typescript configuration, etc. For example we were able to use SASS because we chose to use loaders that could handle SASS files, another example was setting environment variables in our scripts inside the package.json. There is a lot more that you can do with webpack and babel, but for the beginners what I showed in the video is a good starting point. And hopefully I made it clear how to use new loaders, so if you find yourself in a situation where you want to handle some sort of file, e.g. CSV, then you can do a bit of googling to find a CSV loader and add that to your webpack configuration.
@mihaimyh
@mihaimyh 4 года назад
@@letscode7478 Thank you for the explanation.
Далее
React Webpack Setup From Scratch
20:53
Просмотров 59 тыс.
Самая сложная маска…
00:32
Просмотров 1,2 млн
Watermelon magic box! #shorts by Leisi Crazy
00:20
Webpack 5 and Typescript Project Setup Walkthrough
23:16
Creating and Understanding a Basic Webpack 5 Setup
41:49
Understanding React's UI Rendering Process
29:07
Просмотров 215 тыс.
Webpack 5 Crash Course | Frontend Development Setup
41:17
React TypeScript Webpack - Setup From Scratch  (1/8)
17:21
Самая сложная маска…
00:32
Просмотров 1,2 млн