All language subtitles for 004 Building The Code For Production_en

af Afrikaans
sq Albanian
am Amharic
ar Arabic
hy Armenian
az Azerbaijani
eu Basque
be Belarusian
bn Bengali
bs Bosnian
bg Bulgarian
ca Catalan
ceb Cebuano
ny Chichewa
zh-CN Chinese (Simplified)
zh-TW Chinese (Traditional)
co Corsican
hr Croatian
cs Czech
da Danish
nl Dutch
en English
eo Esperanto
et Estonian
tl Filipino
fi Finnish
fr French
fy Frisian
gl Galician
ka Georgian
de German
el Greek
gu Gujarati
ht Haitian Creole
ha Hausa
haw Hawaiian
iw Hebrew
hi Hindi
hmn Hmong
hu Hungarian
is Icelandic
ig Igbo
id Indonesian
ga Irish
it Italian
ja Japanese
jw Javanese
kn Kannada
kk Kazakh
km Khmer
ko Korean
ku Kurdish (Kurmanji)
ky Kyrgyz
lo Lao
la Latin
lv Latvian
lt Lithuanian
lb Luxembourgish
mk Macedonian
mg Malagasy
ms Malay
ml Malayalam
mt Maltese
mi Maori
mr Marathi
mn Mongolian
my Myanmar (Burmese)
ne Nepali
no Norwegian
ps Pashto
fa Persian Download
pl Polish
pt Portuguese
pa Punjabi
ro Romanian
ru Russian
sm Samoan
gd Scots Gaelic
sr Serbian
st Sesotho
sn Shona
sd Sindhi
si Sinhala
sk Slovak
sl Slovenian
so Somali
es Spanish
su Sundanese
sw Swahili
sv Swedish
tg Tajik
ta Tamil
te Telugu
th Thai
tr Turkish
uk Ukrainian
ur Urdu
uz Uzbek
vi Vietnamese
cy Welsh
xh Xhosa
yi Yiddish
yo Yoruba
zu Zulu
or Odia (Oriya)
rw Kinyarwanda
tk Turkmen
tt Tatar
ug Uyghur
Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated: 1 00:00:02,040 --> 00:00:04,460 So, now we optimized our code 2 00:00:04,460 --> 00:00:07,340 maybe with React Memo, but especially 3 00:00:07,340 --> 00:00:10,760 as shown in the last lecture with lazy loading 4 00:00:10,760 --> 00:00:14,160 now we can build our app for production. 5 00:00:14,160 --> 00:00:16,940 And with that, I mean that we can run a script 6 00:00:16,940 --> 00:00:19,820 which will take all our code, convert it 7 00:00:19,820 --> 00:00:23,020 to JavaScript code that the browser understands 8 00:00:23,020 --> 00:00:28,020 and code that is as small and bundled up as possible. 9 00:00:29,140 --> 00:00:30,840 Now, for this, we need to go back 10 00:00:30,840 --> 00:00:32,900 to our application and we can take 11 00:00:32,900 --> 00:00:35,420 a look at the packaged JSON file. 12 00:00:35,420 --> 00:00:37,260 Here, we've got a couple of scripts, 13 00:00:37,260 --> 00:00:40,290 which are baked into this project setup. 14 00:00:40,290 --> 00:00:44,200 And thus far, we always used NPM start. 15 00:00:44,200 --> 00:00:46,470 This also runs a script under the hood, 16 00:00:46,470 --> 00:00:50,370 but it runs a script which does transform our code 17 00:00:50,370 --> 00:00:52,180 so that it runs in the browser, 18 00:00:52,180 --> 00:00:54,800 but it does not optimize the code yet. 19 00:00:54,800 --> 00:00:57,550 And it does spin up a development server, 20 00:00:57,550 --> 00:01:00,860 which hosts this development code. 21 00:01:00,860 --> 00:01:04,230 Now for production, we want to run the build command. 22 00:01:04,230 --> 00:01:06,840 This will also transform our code, 23 00:01:06,840 --> 00:01:10,220 but optimize and shrink it as much as possible. 24 00:01:10,220 --> 00:01:12,463 And it will not start a server. 25 00:01:13,350 --> 00:01:16,060 So hence here, I'll quit this development process 26 00:01:16,060 --> 00:01:19,110 and now we can run npm run build. 27 00:01:19,110 --> 00:01:22,993 That's how you run this build script, npm run build. 28 00:01:23,970 --> 00:01:27,580 Now, this will build that production output, 29 00:01:27,580 --> 00:01:29,840 as it says down there, and it can take 30 00:01:29,840 --> 00:01:32,100 a couple of seconds until it it's done. 31 00:01:32,100 --> 00:01:33,393 So, let's wait for that. 32 00:01:34,640 --> 00:01:36,590 Here we go, now we're done. 33 00:01:36,590 --> 00:01:40,810 It also shows us how we could install a basic server 34 00:01:40,810 --> 00:01:44,130 to preview this production app on our local machine 35 00:01:44,130 --> 00:01:47,070 because it doesn't start a server automatically anymore 36 00:01:47,070 --> 00:01:50,270 for this command but, at the moment, we can ignore this. 37 00:01:50,270 --> 00:01:54,620 If we scroll up a bit further, we also see what it did 38 00:01:54,620 --> 00:01:58,390 and it shows us which files it generated. 39 00:01:58,390 --> 00:02:00,750 And we can find all those files 40 00:02:00,750 --> 00:02:03,420 in a newly added build folder. 41 00:02:03,420 --> 00:02:06,300 Now, this is a super important folder. 42 00:02:06,300 --> 00:02:09,210 The build folder or, to be precise, 43 00:02:09,210 --> 00:02:11,190 the content of this build folder 44 00:02:11,190 --> 00:02:15,000 holds all the code you need to deploy in the end. 45 00:02:15,000 --> 00:02:18,300 This is the code, or these are the files, 46 00:02:18,300 --> 00:02:22,410 which you need to move onto your server later, 47 00:02:22,410 --> 00:02:25,480 so that your application runs there. 48 00:02:25,480 --> 00:02:27,450 Now, you should never change the code 49 00:02:27,450 --> 00:02:29,870 in this build folder because the files 50 00:02:29,870 --> 00:02:32,760 in there will be overwritten automatically 51 00:02:32,760 --> 00:02:35,960 whenever you rerun npm run build. 52 00:02:35,960 --> 00:02:38,710 Instead, change your code in the source folder, 53 00:02:38,710 --> 00:02:41,050 and maybe also in the public folder. 54 00:02:41,050 --> 00:02:44,240 Here, you can add your own favicon, for example, 55 00:02:44,240 --> 00:02:48,433 or change your robots.txt file for search engine crawlers. 56 00:02:49,480 --> 00:02:51,410 I will go with the defaults there 57 00:02:51,410 --> 00:02:54,100 and, hence, now this is the build folder content 58 00:02:54,100 --> 00:02:57,303 that we will move onto a real server in the next lecture. 59 00:02:58,200 --> 00:03:00,860 Now, before we go there, I want to highlight 60 00:03:00,860 --> 00:03:03,830 that it's the static folder in the build folder 61 00:03:03,830 --> 00:03:07,470 that contains your optimized CSS code. 62 00:03:07,470 --> 00:03:09,880 And, most importantly, the optimized 63 00:03:09,880 --> 00:03:13,110 and browser ready, JavaScript code. 64 00:03:13,110 --> 00:03:16,250 Here, we see all the JavaScript code we wrote 65 00:03:16,250 --> 00:03:19,030 just translated and optimized. 66 00:03:19,030 --> 00:03:21,210 And, of course, it's highly unreadable, 67 00:03:21,210 --> 00:03:23,160 but it is the code we wrote in the end, 68 00:03:23,160 --> 00:03:25,760 as we can tell by the CSS classes 69 00:03:25,760 --> 00:03:27,333 we see in there, for example. 70 00:03:28,590 --> 00:03:31,590 So, now, that's the content which we want to deploy. 71 00:03:31,590 --> 00:03:34,810 And that, of course, brings up one important question, 72 00:03:34,810 --> 00:03:37,460 how do we get this code onto a server 73 00:03:37,460 --> 00:03:39,723 and which kind of server do we need? 5813

Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.