Skip to content

Use -p flag in webpack for minification and exclude externals react a… - #159

Merged
claydiffrient merged 1 commit into
reactjs:development-improvementsfrom
doque:development-improvements
Apr 14, 2016
Merged

Use -p flag in webpack for minification and exclude externals react a…#159
claydiffrient merged 1 commit into
reactjs:development-improvementsfrom
doque:development-improvements

Conversation

@doque

@doque doque commented Apr 13, 2016

Copy link
Copy Markdown
Contributor

Fixes #144 .

Changes proposed:

  • Use webpack -p for minification instead of UglifyJS Plugin
  • Designate react and react-dom as externals in webpack config to exclude them from build

Reduces minified build size to 14.4kB.

@diasbruno

Copy link
Copy Markdown
Collaborator

This seems really nice. I'll test it.

@diasbruno

Copy link
Copy Markdown
Collaborator

We already know the numbers, but just to validate.

With build script and browserify:

react-modal.js     53K
react-modal.min.js 22K

With webpack:

  • reactjs/development-improvements:
             Asset    Size  Chunks             Chunk Names
    react-modal.js  719 kB    0, 1  [emitted]  react-modal
react-modal.min.js  190 kB    1, 0  [emitted]  react-modal.min
  • doque/development-improvements:
             Asset     Size  Chunks             Chunk Names
    react-modal.js    57 kB    0, 1  [emitted]  react-modal
react-modal.min.js  14.4 kB    1, 0  [emitted]  react-modal.min

This is awesome, @doque.

@diasbruno

Copy link
Copy Markdown
Collaborator

@doque It seems that without -p has the same effect as using webpack.optimize.UglifyJsPlugin, the file size i got are the same.

@claydiffrient
claydiffrient merged commit 9823bc5 into reactjs:development-improvements Apr 14, 2016
@doque
doque deleted the development-improvements branch April 15, 2016 07:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants