weexteam/A-pack-tool-for-Apache-Weex

关于weex run ios 的问题

Opened this issue · 5 comments

命令weex run ios会开启HotReload和FileWatcher功能,然后启动模拟器或者真机,然后就能监听实时刷新了。可是我们之前的项目没有创建在weex项目是,安卓和iOS都是分离的,所以只想拥有weex run ios命令下的HotReload和FileWatcher功能,后续的启动真机或模拟器我们会自己启动。也就是https://github.com/weexteam/weex-pack/blob/d125e25e87c933bd725be584ab96bd059c2371f8/src/run/ios.js#L487

能提供weex run这个命令只是HotReload和FileWatcher功能,而不启动iOS端吗。或者用weex-pack源码怎么添加这个我想要的功能呢

redye commented

我也想要这个功能,weex run ios 做的工作太多了

redye commented

@songxing10000 改写 ios.js 文件,后续的服务不要启动就好了

var runIOS = function runIOS(options) {
  logger.info('npm run build');
  utils.checkAndInstallForIosDeploy().then(utils.buildJS).then(function () {
    return copyJsbundleAssets(process.cwd(), 'dist', 'platforms/ios/bundlejs/');
  }).then(function () {
    return passOptions(options);
  }).then(prepareIOS).then(startHotReloadServer).then(registeFileWatcher).then(resolveConfig).then(installDep).then(findIOSDevice).then(chooseDevice).then(buildApp).then(runApp).catch(function (err) {
    if (err) {
      logger.error('Error:' + (err.stack || err));
      exit(0);
    }
  });
};

改成

var runIOS = function runIOS(options) {
  logger.info('npm run build');
  utils.checkAndInstallForIosDeploy().then(utils.buildJS).then(function () {
    return copyJsbundleAssets(process.cwd(), 'dist', 'platforms/ios/bundlejs/');
  }).then(function () {
    return passOptions(options);
  }).then(prepareIOS).then(startHotReloadServer).then(registeFileWatcher).then(resolveConfig).catch(function (err) {
    if (err) {
      logger.error('Error:' + (err.stack || err));
      exit(0);
    }
  });
};

当然,最好是新建一个命令 😎

@redye 大佬你这js怎么用啊

@redye 不知道是不是最新版weex的问题改了没效果。按你的修改,在工程目录执行 weex run hot ,然后在手动启动ios项目,再修改vue文件再保存页面没有刷新,奇怪,感觉是不是我哪里操作错了,求指导