Reputation: 311
I am trying to build my simple Reactjs application via browserify+reactify but see the error in console
Note: The code generator has deoptimised the styling of "http://localhost:8000/app.js" as it exceeds the max of "100KB".
//index.js size 5KB
var React = require('react');
var ReactDOM = require('react-dom');
var CommentList = React.createClass({...});
//terminal
browserify -t reactify index.js > app.js //after that size more than 600KB
Any ideas how to solve it?
Upvotes: 1
Views: 1030
Reputation: 51
In react/redux/webpack/babel build fixed this error by removing script tag type text/babel
<script type="text/babel" src="/js/bundle.js"></script>
Into
<script src="/js/bundle.js"></script>
Upvotes: 3
Reputation: 306
Setting NODE_ENV
environment var before running browserify like this:
NODE_ENV=production browserify -t reactify index.js > app.js
If the bundle file size is still too large, consider using uglify:
NODE_ENV=production browserify -t reactify index.js | uglifyjs -c > app.js
Upvotes: 1