Skip to content
New issue

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

lib.dll.js在H5环境,1.2.0-beta比1.1.9要大136kb #1371

Closed
sunhaikuo opened this issue Dec 4, 2018 · 9 comments
Closed

lib.dll.js在H5环境,1.2.0-beta比1.1.9要大136kb #1371

sunhaikuo opened this issue Dec 4, 2018 · 9 comments
Assignees
Labels
enhancement New feature or request

Comments

@sunhaikuo
Copy link
Contributor

sunhaikuo commented Dec 4, 2018

问题描述
H5代码里面代码打包lib.dll.js,包体积大了136kb
在1.2.0-beta中,打包后lib.dll.js体积为:484kb
回退到1.1.9中,lib.dll.js体积为:348kb

复现步骤
[复现问题的步骤]

  1. 使用v1.2.0-beta.6版taro
  2. npm run build:h5
  3. 使用v1.1.9版taro
  4. npm run build:h5

[或者可以直接贴源代码,能贴文字就不要截图]
package.json内容为:

{
"dependencies": {
    "@analytics/wechat-sdk": "^1.9.1-alpha.2",
    "@tarojs/async-await": "^1.1.8",
    "@tarojs/components": "^1.1.8",
    "@tarojs/redux": "^1.1.8",
    "@tarojs/redux-h5": "^1.1.8",
    "@tarojs/router": "^1.1.8",
    "@tarojs/taro": "^1.1.8",
    "@tarojs/taro-alipay": "^1.1.8",
    "@tarojs/taro-h5": "^1.1.8",
    "@tarojs/taro-swan": "^1.1.8",
    "@tarojs/taro-weapp": "^1.1.8",
    "classname": "^0.0.0",
    "lodash.merge": "^4.6.1",
    "nervjs": "^1.3.9",
    "redux": "^4.0.0",
    "redux-logger": "^3.0.6",
    "redux-thunk": "^2.3.0",
    "symbol-observable": "^1.2.0",
  },
  "devDependencies": {
    "@tarojs/cli": "^1.1.8",
    "@tarojs/plugin-babel": "^1.1.8",
    "@tarojs/plugin-csso": "^1.1.8",
    "@tarojs/plugin-stylus": "^1.1.8",
    "@tarojs/plugin-uglifyjs": "^1.1.8",
    "@tarojs/webpack-runner": "^1.1.8",
    "@types/react": "^16.4.8",
    "@types/webpack-env": "^1.13.6",
    "babel-eslint": "^8.2.3",
    "babel-plugin-transform-class-properties": "^6.24.1",
    "babel-plugin-transform-decorators-legacy": "^1.3.4",
    "babel-plugin-transform-jsx-stylesheet": "^0.6.5",
    "babel-plugin-transform-object-rest-spread": "^6.26.0",
    "babel-preset-env": "^1.6.1",
    "eslint": "^4.19.1",
    "eslint-config-taro": "^1.1.8",
    "eslint-plugin-import": "^2.12.0",
    "eslint-plugin-react": "^7.8.2",
    "eslint-plugin-taro": "^1.1.8",
    "eslint-plugin-typescript": "^0.12.0",
    "fs-extra": "^7.0.1",
    "typescript": "^3.0.1"
  }
}

期望行为
打包后lib.dll体积在348kb左右

报错信息

系统信息

  • 操作系统: macos 0.13.6
  • Taro 版本:v1.2.0-beta.6
  • Node.js 版本:
  • 报错平台 [h5, weapp]

补充信息

@taro-bot
Copy link

taro-bot bot commented Dec 4, 2018

欢迎提交 Issue~

如果你提交的是 bug 报告,请务必遵循 Issue 模板的规范,尽量用简洁的语言描述你的问题,最好能提供一个稳定简单的复现。🙏🙏🙏

如果你的信息提供过于模糊或不足,或者已经其他 issue 已经存在相关内容,你的 issue 有可能会被关闭。

Good luck and happy coding~

@luckyadam luckyadam added the H5 label Dec 4, 2018
@taro-bot
Copy link

taro-bot bot commented Dec 4, 2018

CC @Littly

@taro-bot taro-bot bot assigned Littly Dec 4, 2018
@Littly
Copy link
Contributor

Littly commented Dec 5, 2018

项目dependencies里面都没有mobx 怎么会把mobx打进去呢?

@sunhaikuo sunhaikuo changed the title H5环境在没有使用mobx情况下,也会打包到lib.dll.js里 lib.dll.js在H5环境,1.2.0-beta比1.1.9要大136kb Dec 6, 2018
@sunhaikuo
Copy link
Contributor Author

@Littly 之前调查结果有误,没mbox什么事;不过相同的配置,打出来的包的确大了100多k,这个能否给下原因?

@Littly
Copy link
Contributor

Littly commented Dec 7, 2018

因为基础组件库 @tarojs/components 变大了。

a2e80ca 之后,为了解决swiper的各种问题,我们引入 https://github.com/nolimits4web/swiper 作为taro中 swiper 的基础实现。

https://github.com/nolimits4web/swiper/blob/master/dist/js/swiper.js 源码 js 有 8k 行左右,导致基础库从此变大了。

后续我们计划在打包时进行tree shaking优化,可以解决打包文件过大的问题。

@taro-bot
Copy link

taro-bot bot commented Dec 18, 2018

Hello~

您的问题楼上已经有了确切的回答,如果没有更多的问题这个 issue 将在 15 天后被自动关闭。

如果您在这 15 天中更新更多信息自动关闭的流程会自动取消,如有其他问题也可以发起新的 Issue。

Good luck and happy coding~

@taro-bot taro-bot bot removed the to be closed label Dec 19, 2018
@taro-bot taro-bot bot closed this as completed Dec 19, 2018
@taro-bot
Copy link

taro-bot bot commented Dec 19, 2018

Hello~

您的问题楼上已经有了确切的回答,如果没有更多的问题这个 issue 将在 15 天后被自动关闭。

如果您在这 15 天中更新更多信息自动关闭的流程会自动取消,如有其他问题也可以发起新的 Issue。

Good luck and happy coding~

@jswxwxf
Copy link

jswxwxf commented Feb 20, 2019

在小程序环境下也一样啊,用了最新的 1.2.13 版本以后,体积也变大了~
2019-02-20 10 55 25

@jswxwxf
Copy link

jswxwxf commented Feb 20, 2019

sorry,发现是 taro-ui 的问题……

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants