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

[taro-2.0.0]期望微信小程序在watch下也能压缩代码 #5322

Closed
sillyhong opened this issue Jan 14, 2020 · 7 comments
Closed

[taro-2.0.0]期望微信小程序在watch下也能压缩代码 #5322

sillyhong opened this issue Jan 14, 2020 · 7 comments
Assignees

Comments

@sillyhong
Copy link

sillyhong commented Jan 14, 2020

问题描述

Taro2.0下执行以下命令,输出完整的 webpack 打包信息后,没有继续监听文件,直接退出进程

NODE_ENV=production taro build --type weapp --watch 

复现步骤

  1. 执行 NODE_ENV=production taro build --type weapp --watch
  2. 编译成功,输出 webpack 打包信息
  3. 进程退出,没有进行文件监听 (watch无效)

注:NODE_ENV=production taro build --type h5 --watch 表现正常。既可以压缩,又可以进行文件监听

期望行为

  1. 执行 NODE_ENV=production taro build --type weapp --watch
  2. 编译成功,输出webpack打包信息
  3. 文件正常监听
  4. 修改文件
  5. 再次打包

系统信息

  Taro CLI 2.0.0 environment info:
    System:
      OS: macOS 10.14.6
      Shell: 3.2.57 - /bin/bash
    Binaries:
      Node: 10.16.0 - /usr/local/bin/node
      npm: 6.9.0 - /usr/local/bin/npm
    npmPackages:
      @tarojs/cli: 2.0.0 => 2.0.0 
      @tarojs/components: 2.0.0 => 2.0.0 
      @tarojs/mini-runner: 2.0.0 => 2.0.0 
      @tarojs/plugin-babel: 2.0.0 => 2.0.0 
      @tarojs/plugin-csso: 2.0.0 => 2.0.0 
      @tarojs/plugin-sass: 2.0.0 => 2.0.0 
      @tarojs/plugin-uglifyjs: 2.0.0 => 2.0.0 
      @tarojs/redux: 2.0.0 => 2.0.0 
      @tarojs/redux-h5: 2.0.0 => 2.0.0 
      @tarojs/router: 2.0.0 => 2.0.0 
      @tarojs/taro: 2.0.0 => 2.0.0 
      @tarojs/taro-alipay: 2.0.0 => 2.0.0 
      @tarojs/taro-h5: 2.0.0 => 2.0.0 
      @tarojs/taro-swan: 2.0.0 => 2.0.0 
      @tarojs/taro-tt: 2.0.0 => 2.0.0 
      @tarojs/taro-weapp: 2.0.0 => 2.0.0 
      @tarojs/webpack-runner: 2.0.0 => 2.0.0 
      eslint-config-taro: 2.0.0 => 2.0.0 
      eslint-plugin-taro: 2.0.0 => 2.0.0 
      nerv-devtools: ^1.5.6 => 1.5.6 
      nervjs: ^1.5.6 => 1.5.6 
      react: ^16.10.2 => 16.12.0 
    npmGlobalPackages:
      typescript: 3.7.2

补充信息

与问题相关的issue:
希望Watch时也能支持压缩 #1219
在开发时如何配置js文件压缩?#2470

相关截图如下:
image

如果您有功能上的建议,可以提到 FeatHub

使用上的问题,欢迎在「Taro 社区」一起交流

@taro-bot
Copy link

taro-bot bot commented Jan 14, 2020

CC @luckyadam

@taro-bot
Copy link

taro-bot bot commented Jan 14, 2020

欢迎提交 Issue~

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

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

Good luck and happy coding~

@shenghanqin shenghanqin changed the title 期望微信小程序在watch下也能压缩代码 [taro-2.0.0]期望微信小程序在watch下也能压缩代码 Jan 15, 2020
@shenghanqin
Copy link
Collaborator

不错。这样可以调试即将上线的代码。

@Garfield550
Copy link
Collaborator

dev 配置里配置 uglify 可以实现吗?

@raohong
Copy link

raohong commented Jan 15, 2020

勾选 [上传时自动压缩混淆代码]

@sillyhong
Copy link
Author

sillyhong commented Jan 16, 2020

勾选 [上传时自动压缩混淆代码]
最终目的不单纯是压缩代码,更重要的是调试代码

@sillyhong
Copy link
Author

dev 配置里配置 uglify 可以实现吗?

也有想过,但是成本会较高。其实只需要把webpack 的 mode 设置为 production就好了,不需要自己再配置 uglify

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

5 participants