Coming soon - Get a detailed view of why an account is flagged as spam!
view details

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.

9
Questions about React/Redux and webpack
Post Body

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

Author
Account Strength
100%
Account Age
10 years
Verified Email
Yes
Verified Flair
No
Total Karma
6,408
Link Karma
1,360
Comment Karma
5,002
Profile updated: 4 days ago
Posts updated: 1 year ago
front-end

Subreddit

Post Details

We try to extract some basic information from the post title. This is not always successful or accurate, please use your best judgement and compare these values to the post title and body for confirmation.
Posted
7 years ago