gpt4 book ai didi

javascript - 通过 browserify + reactify 构建后 Reactjs 应用程序的文件大小太大

转载 作者:行者123 更新时间:2023-11-30 11:58:23 24 4
gpt4 key购买 nike

我正在尝试通过 browserify+reactify 构建我的简单 Reactjs 应用程序,但在控制台中看到错误

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

有什么解决办法吗?

最佳答案

在 react/redux/webpack/babel 构建中通过删除脚本标签类型 text/babel 修复了这个错误

<script type="text/babel" src="/js/bundle.js"></script>

进入

<script src="/js/bundle.js"></script>

关于javascript - 通过 browserify + reactify 构建后 Reactjs 应用程序的文件大小太大,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37304411/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com