We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
webpack打包完成后,发现index.js有将近600k(压缩后),其中,有bn.js和ellptic.js有将近400k大小,分析node_modules依赖后,发现,postcss-cssnext包里有这个依赖,是我们的postcss-loader在线上环境也开启了source-map: true导致的。 把source-map: true 移除后,发现这两个包还在。 一顿google后,发现如果在项目中引用了crypto,也对导致webpack打入这两个依赖。 之后,在我们的请求库里,发现我们使用了[email protected],而crypto-js的core.js文件中有这么一段代码 // Native crypto import via require (NodeJS) if (!crypto && typeof require === 'function') { try { crypto = require('crypto'); } catch (err) {} } 导致webpack打包的时候还是依赖了crypto。然而,之前的版本[email protected]并没有加入这段代码,所以暂时把crypto-js的版本锁定为3.3.0。
// Native crypto import via require (NodeJS) if (!crypto && typeof require === 'function') { try { crypto = require('crypto'); } catch (err) {} }
这两个改动之后,index.js包里终于没有bn.js和ellptic.js,包大小也减少了400k左右。
The text was updated successfully, but these errors were encountered:
No branches or pull requests
webpack打包完成后,发现index.js有将近600k(压缩后),其中,有bn.js和ellptic.js有将近400k大小,分析node_modules依赖后,发现,postcss-cssnext包里有这个依赖,是我们的postcss-loader在线上环境也开启了source-map: true导致的。
把source-map: true 移除后,发现这两个包还在。
一顿google后,发现如果在项目中引用了crypto,也对导致webpack打入这两个依赖。
之后,在我们的请求库里,发现我们使用了[email protected],而crypto-js的core.js文件中有这么一段代码
// Native crypto import via require (NodeJS) if (!crypto && typeof require === 'function') { try { crypto = require('crypto'); } catch (err) {} }
导致webpack打包的时候还是依赖了crypto。然而,之前的版本[email protected]并没有加入这段代码,所以暂时把crypto-js的版本锁定为3.3.0。
这两个改动之后,index.js包里终于没有bn.js和ellptic.js,包大小也减少了400k左右。
The text was updated successfully, but these errors were encountered: