This post has been de-listed
It is no longer included in search results and normal feeds (front page, hot posts, subreddit posts, etc). It remains visible only via the author's post history.
Hey /r/webdev
TL;DR at bottom
So recently I've gotten around to looking into React and Redux and how to set it up with webpack. I've been able to get through a couple of React tutorials and just finished one on Redux, and I've got a few questions regarding these libraries. Would appreciate some insight.
About bundling up for the "production build," what is the best practice or correct way to do it? Currently I just run the webpack
command with the NODE_ENV=production
to compile it all down into a single huge JS file (about 2.3 MB unminified, 212KB minified) and just insert it into my index.html
with a script
tag. I'm not sure if that's what I'm supposed to do since the user will end up having to download a potentially very large file to use the site. I've looked at several posts which talk about ways to reduce to size of the finalized bundle, but is that the file that is ultimately served to the users? If gzipped it becomes somewhere around 64KB but that doesn't work on a static page.
Kind of following up with that, how exactly are React apps usually served? I've seen instructions saying to use the serve
command and such, but it works just fine when bundled up and loaded through a script
tag, right? The React Dev Tools extension doesn't detect it when done this way, though. I currently have a portfolio site which sits on an apache server through DigitalOcean VPS, so should I just bundle my app up and host it statically there? My first test app was bootstrapped with create-react-app, and the scripts for building it seemed to do it in a way such that when hosted through ghpages the dev tools extension is able to detect it.
TL;DR: Do I just throw my huge bundled webpack script onto the HTML in a script tag src link and serve it as is, or is there a better/correct way to do it?
Edit: clarifications
Post Details
- Posted
- 7 years ago
- Reddit URL
- View post on reddit.com
- External URL
- reddit.com/r/webdev/comm...