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

执行dev:weapp时,在代码不变动的情况下,前后两次build结果不同。 #4542

Closed
SunskyXH opened this issue Sep 26, 2019 · 4 comments

Comments

@SunskyXH
Copy link

SunskyXH commented Sep 26, 2019

问题描述
[问题描述:站在其它人的角度尽可能清晰地、简洁地把问题描述清楚]

  • 执行命令dev:weapp第一次build出的代码缺少部分代码,需要再build一次app.ts文件。详情见diff。

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

  1. 执行dev:weapp
  2. 控制台报错。
  3. 不更改代码,保存一次src/app.ts文件,触发文件修改,taro命令行会重新build src/app.ts文件。
  4. 代码正常运行。
  5. diff两次build结果。
From 51085827ae7bf9ce57907c9e4bde06ee31d1d00c Mon Sep 17 00:00:00 2001
From: SunskyXH <[email protected]>
Date: Thu, 26 Sep 2019 15:24:48 +0800
Subject: [PATCH] diff

---
 dist/app.js | 50 ++++++++++++++++++++++++++++++++++----------------
 1 file changed, 34 insertions(+), 16 deletions(-)

diff --git a/dist/app.js b/dist/app.js
index 5db4605..c236514 100644
--- a/dist/app.js
+++ b/dist/app.js
@@ -51,16 +51,27 @@ function _inherits(subClass, superClass) { if (typeof superClass !== "function"
 //   require('nerv-devtools')
 // }
 var store = (0, _index5.default)();
+(0, _index3.setStore)(store);
+
+if (_index3.ReduxContext.Provider) {
+  _index3.ReduxContext.Provider({
+    store: store
+  });
+  _index3.ReduxContext.Provider({
+    store: store
+  });
+}
+
 var recordManager = exports.recordManager = {};
 var innerAudioContext = exports.innerAudioContext = {};
 
-var App = function (_Component) {
-  _inherits(App, _Component);
+var _App = function (_BaseComponent) {
+  _inherits(_App, _BaseComponent);
 
-  function App() {
-    _classCallCheck(this, App);
+  function _App() {
+    _classCallCheck(this, _App);
 
-    var _this = _possibleConstructorReturn(this, (App.__proto__ || Object.getPrototypeOf(App)).apply(this, arguments));
+    var _this = _possibleConstructorReturn(this, (_App.__proto__ || Object.getPrototypeOf(_App)).apply(this, arguments));
 
     _this.config = {
       pages: ['pages/index/index', 'pages/auth/index', 'pages/ten/index'],
@@ -91,7 +102,7 @@ var App = function (_Component) {
     return _this;
   }
 
-  _createClass(App, [{
+  _createClass(_App, [{
     key: "componentDidMount",
     value: function componentDidMount() {
       this.login();
@@ -226,15 +237,22 @@ var App = function (_Component) {
     // 请勿修改此函数
 
   }, {
-    key: "render",
-    value: function render() {
-      return React.createElement(
-        _index3.Provider,
-        { store: store },
-        React.createElement(Index, null)
-      );
-    }
+    key: "_createData",
+    value: function _createData() {}
   }]);
 
-  return App;
-}(_index.Component);
\ No newline at end of file
+  return _App;
+}(_index.Component);
+
+exports.default = _App;
+
+App(require('./npm/@tarojs/taro-weapp/index.js').default.createApp(_App));
+_index2.default.initPxTransform({
+  "designWidth": 375,
+  "deviceRatio": {
+    "375": 0.5,
+    "640": 1.17,
+    "750": 1,
+    "828": 0.905
+  }
+});
\ No newline at end of file
-- 
2.20.1 (Apple Git-117)

期望行为

  • 在代码不变动的情况下,前后两次build结果应该相同。

报错信息

第一次build后的报错截图

image

系统信息

Taro v1.2 及以上版本已添加 taro info 命令,方便大家查看系统及依赖信息,运行该命令后将结果贴下面即可。

Taro info结果

Taro CLI 1.3.19 environment info:
System:
OS: macOS 10.14.5
Shell: 2.7.1 - /usr/local/bin/fish
Binaries:
Node: 10.16.0 - ~/.nvm/versions/node/v10.16.0/bin/node
Yarn: 1.17.3 - /usr/local/bin/yarn
npm: 6.10.3 - ~/.nvm/versions/node/v10.16.0/bin/npm
npmPackages:
@tarojs/async-await: 1.3.19 => 1.3.19
@tarojs/components: 1.3.19 => 1.3.19
@tarojs/plugin-babel: 1.3.19 => 1.3.19
@tarojs/plugin-csso: 1.3.19 => 1.3.19
@tarojs/plugin-stylus: 1.3.19 => 1.3.19
@tarojs/plugin-uglifyjs: 1.3.19 => 1.3.19
@tarojs/redux: 1.3.19 => 1.3.19
@tarojs/redux-h5: 1.3.19 => 1.3.19
@tarojs/router: 1.3.19 => 1.3.19
@tarojs/taro: 1.3.19 => 1.3.19
@tarojs/taro-alipay: 1.3.19 => 1.3.19
@tarojs/taro-h5: 1.3.19 => 1.3.19
@tarojs/taro-swan: 1.3.19 => 1.3.19
@tarojs/taro-tt: 1.3.19 => 1.3.19
@tarojs/taro-weapp: 1.3.19 => 1.3.19
@tarojs/webpack-runner: 1.3.19 => 1.3.19
eslint-config-taro: 1.3.19 => 1.3.19
eslint-plugin-taro: 1.3.19 => 1.3.19
nerv-devtools: ^1.4.5 => 1.4.5
nervjs: ^1.4.5 => 1.4.5
react: ^16.9.0 => 16.9.0
stylelint-config-taro-rn: 1.3.19 => 1.3.19
stylelint-taro-rn: 1.3.19 => 1.3.19
npmGlobalPackages:
typescript: 3.5.3

@taro-bot
Copy link

taro-bot bot commented Sep 26, 2019

欢迎提交 Issue~

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

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

Good luck and happy coding~

@luckyadam
Copy link
Member

没有复现你的问题,请提供一个可以复现的 demo

@taro-bot
Copy link

taro-bot bot commented Sep 26, 2019

Hello~

您的问题我们无法复现。如果有空的话还请拔冗提供一个简单的复现 demo,否则这个 issue 将在 15 天后被自动关闭。

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

Good luck and happy coding~

@DemonWu
Copy link

DemonWu commented Oct 21, 2019

我也有一样的情况,你们那有什么方法处理吗?

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

No branches or pull requests

3 participants