Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated:
1
00:00:02,100 --> 00:00:03,230
Now, up to this point,
2
00:00:03,230 --> 00:00:05,700
I explained a lot about pre-rendering
3
00:00:05,700 --> 00:00:08,200
and how next.js does that.
4
00:00:08,200 --> 00:00:10,840
But we haven't really seen it in action
5
00:00:10,840 --> 00:00:15,610
other than on the running website in development mode.
6
00:00:15,610 --> 00:00:18,870
But I do want to show you what exactly next.js
7
00:00:18,870 --> 00:00:23,090
does do for you when you build the application.
8
00:00:23,090 --> 00:00:26,160
Now, I did mention this build script before,
9
00:00:26,160 --> 00:00:29,840
this build script, that's a script you execute
10
00:00:29,840 --> 00:00:33,890
when you are ready to deploy your next application,
11
00:00:33,890 --> 00:00:38,090
your next.js project and this build step here,
12
00:00:38,090 --> 00:00:41,580
this next build command which has executed in the end
13
00:00:41,580 --> 00:00:45,250
this will then pre-generate your pages.
14
00:00:45,250 --> 00:00:49,340
And to show this to you, here I quit my development server
15
00:00:49,340 --> 00:00:52,460
and I'll run npm run build here.
16
00:00:52,460 --> 00:00:54,980
So I'll execute this build script
17
00:00:54,980 --> 00:00:58,710
and therefore next build, in this project folder.
18
00:00:58,710 --> 00:01:00,740
And what you'll see now is that
19
00:01:00,740 --> 00:01:04,190
it's now creating that optimized production build.
20
00:01:04,190 --> 00:01:06,250
And that can take a couple of seconds,
21
00:01:06,250 --> 00:01:09,900
and after a while, this build process will complete.
22
00:01:09,900 --> 00:01:12,320
Now we got a couple of pieces of information here.
23
00:01:12,320 --> 00:01:14,670
We see that it was successful in the end
24
00:01:14,670 --> 00:01:16,230
because we have no error here.
25
00:01:16,230 --> 00:01:20,950
And we see that it generated two static pages here.
26
00:01:20,950 --> 00:01:24,290
And we see the detailed output down there.
27
00:01:24,290 --> 00:01:26,300
We also have a ledger here at the bottom
28
00:01:26,300 --> 00:01:28,230
telling us that a filled dot
29
00:01:28,230 --> 00:01:31,130
stands for static site generation.
30
00:01:31,130 --> 00:01:34,750
So for a pre-generated page, that was pre-generated
31
00:01:34,750 --> 00:01:37,480
during development or during the build process
32
00:01:37,480 --> 00:01:40,420
because it uses get static props
33
00:01:40,420 --> 00:01:44,250
a Lambda symbol would stand for us server side only page
34
00:01:44,250 --> 00:01:46,640
something we're going to see later,
35
00:01:46,640 --> 00:01:49,330
an empty dots stands for static.
36
00:01:49,330 --> 00:01:51,500
So all's up page pre-generated
37
00:01:51,500 --> 00:01:54,370
but a page that doesn't even need any data
38
00:01:54,370 --> 00:01:56,730
and therefore doesn't use get static props
39
00:01:56,730 --> 00:01:58,620
or anything like that.
40
00:01:58,620 --> 00:02:01,340
And if I scroll back up again, we see that in the end
41
00:02:01,340 --> 00:02:04,020
the two pages that were pre-generated,
42
00:02:04,020 --> 00:02:06,820
is to starting page so slash nothing.
43
00:02:06,820 --> 00:02:11,150
So in next.js and then a 404 page.
44
00:02:11,150 --> 00:02:14,950
We haven't added one but you get one for free automatically.
45
00:02:14,950 --> 00:02:17,880
We can ignore this underscore app thing here.
46
00:02:17,880 --> 00:02:20,800
Now the 404 page has an empty dot
47
00:02:20,800 --> 00:02:23,810
which means it was pre-generated without any data,
48
00:02:23,810 --> 00:02:26,260
which makes sense, we didn't add our own one
49
00:02:26,260 --> 00:02:29,310
and the default one is not fetching any data.
50
00:02:29,310 --> 00:02:34,060
And index.js, so slash nothing was statically pre-generated
51
00:02:34,060 --> 00:02:36,600
with help of get static props.
52
00:02:36,600 --> 00:02:39,180
That's why we have that filled dot here.
53
00:02:39,180 --> 00:02:41,000
That's how we can read this.
54
00:02:41,000 --> 00:02:42,740
And we can also see this, if we have a look
55
00:02:42,740 --> 00:02:45,690
at the .next folder, which was generated now
56
00:02:45,690 --> 00:02:48,160
which holds this production ready code.
57
00:02:48,160 --> 00:02:51,910
Which holds the output of the npm run build command.
58
00:02:51,910 --> 00:02:54,630
Then in there we do have a server folder
59
00:02:54,630 --> 00:02:55,950
into which we can dive.
60
00:02:55,950 --> 00:03:00,950
And in there we see those pre-generated HTML files.
61
00:03:01,010 --> 00:03:06,010
The two pre-generated HTML files and in index HTML,
62
00:03:06,380 --> 00:03:10,080
if you open that, you also find that product data
63
00:03:10,080 --> 00:03:11,530
in the end in there
64
00:03:11,530 --> 00:03:14,240
because that's the pre-generated page,
65
00:03:14,240 --> 00:03:17,430
which we also see if we would visit this page
66
00:03:17,430 --> 00:03:19,030
in the browser.
67
00:03:19,030 --> 00:03:21,050
And that's that pre-generated page,
68
00:03:21,050 --> 00:03:23,990
which is sent back on the initial request
69
00:03:23,990 --> 00:03:26,190
to the search engine crawler
70
00:03:26,190 --> 00:03:29,100
or to the visitors off our page.
71
00:03:29,100 --> 00:03:32,710
And we can even previewed this production ready page here
72
00:03:34,190 --> 00:03:39,190
by running npm start, npm starts the production ready page
73
00:03:40,090 --> 00:03:42,380
with a nodejs server,
74
00:03:42,380 --> 00:03:44,330
and whilst we typically would do that
75
00:03:44,330 --> 00:03:47,740
on some remote computer to expose it to the world,
76
00:03:47,740 --> 00:03:51,090
we can also do that locally on our machine.
77
00:03:51,090 --> 00:03:54,600
And then again, it starts on local host 3000
78
00:03:54,600 --> 00:03:57,340
but this now is not the development server
79
00:03:57,340 --> 00:04:02,340
but the real server serving the production ready page.
80
00:04:02,350 --> 00:04:05,040
So if I visit local hosts 3000
81
00:04:05,040 --> 00:04:08,390
if I entered this into browser, I still see this page
82
00:04:08,390 --> 00:04:11,130
with the pre-rendered products,
83
00:04:11,130 --> 00:04:14,060
because we just saw that in the pages folder,
84
00:04:14,060 --> 00:04:15,810
in this .next folder
85
00:04:15,810 --> 00:04:19,760
which holds is production ready site.
86
00:04:19,760 --> 00:04:22,990
Side note, in the page source,
87
00:04:22,990 --> 00:04:27,820
you'll also see there is some script tag injected by next.js
88
00:04:27,820 --> 00:04:30,926
which in the end includes that data,
89
00:04:30,926 --> 00:04:33,580
with which the data was populated.
90
00:04:33,580 --> 00:04:36,920
That is needed for this hydration
91
00:04:36,920 --> 00:04:40,620
where the pre-rendered HTML code is then connected
92
00:04:40,620 --> 00:04:44,240
with the react application and that data
93
00:04:44,240 --> 00:04:46,190
which was pre-fetched is handed off
94
00:04:46,190 --> 00:04:47,930
to that react application
95
00:04:47,930 --> 00:04:49,720
so that the react application
96
00:04:49,720 --> 00:04:52,790
knows that this was dynamic data
97
00:04:52,790 --> 00:04:55,490
and which kind of data should be rendered.
98
00:04:55,490 --> 00:04:58,250
So that if you continued working with that data
99
00:04:58,250 --> 00:05:01,850
and you would be updating that data through react.js
100
00:05:01,850 --> 00:05:06,110
react would know which kind of data was received originally.
101
00:05:06,110 --> 00:05:09,670
That's just a side note, it's all done automatically.
102
00:05:09,670 --> 00:05:12,560
We don't need to do anything for that
103
00:05:12,560 --> 00:05:15,470
but that is how next.js does work here
104
00:05:15,470 --> 00:05:18,023
and how it pre renders pages for you.
8281
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.