Skip to content
This repository has been archived by the owner on Sep 11, 2018. It is now read-only.

Reduce size for server bundle #97

Closed
MrEfrem opened this issue Sep 21, 2015 · 3 comments
Closed

Reduce size for server bundle #97

MrEfrem opened this issue Sep 21, 2015 · 3 comments

Comments

@MrEfrem
Copy link

MrEfrem commented Sep 21, 2015

It is possible to reduce server bundle several times if we exclude from it node_modules (https://github.com/MrEfrem/react-redux-starter-kit/blob/master/build/webpack/server.js):

name    : 'server',
  target  : 'node',
  entry   : {
    app : [
      paths.src('entry-points/server')
    ]
  },
  externals: fs.readdirSync('node_modules').filter(function(x) { return x !== '.bin' }),
...

And also I would clean UglifyJsPlugin from bundle, because differently in case of an error in stack trace it isn't clear where in bundle to look it.
And generally what sense in it for NodeJS to squeeze bundle?

@MrEfrem
Copy link
Author

MrEfrem commented Sep 21, 2015

Still it is necessary to add

__ CLIENT __: false

in "definePlugin" for server bundle and

__ SERVER __: false

for client bundle that in both assemblies there were no errors like

Runtime error: __ CLIENT __ is undefined

on server side and vice versa.

@dvdzkwsk
Copy link
Owner

Wow that's brilliant, never even thought of that. I'll try to get this in in the next day or two. Thanks!

Also I definitely agree about getting rid of uglify for the server bundle, good point.

@dvdzkwsk
Copy link
Owner

Implemented both of these in #100. Thanks for the idea!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants