easy-team/easywebpack

无法使用watch选项?

Zohner opened this issue · 6 comments

重现步骤:

  1. 使用 easy init 初始化项目,选择 create Nunjucks + HTML project boilerplate 类型
  2. 在webpack.config.js中添加watch: true节点
  3. 运行编译 npm run build

结果,报 TypeError 错误

D:\lab\easywebpack\01\node_modules\webpack-tool\lib\tool.js:115
    compiler.plugin('done', compilation => {
             ^

TypeError: compiler.plugin is not a function
    at WebpackTool.build (D:\lab\easywebpack\01\node_modules\webpack-tool\lib\to
ol.js:115:14)
    at Object.exports.build (D:\lab\easywebpack\01\node_modules\easywebpack\inde
x.js:47:28)
    at build (D:\lab\easywebpack\01\node_modules\easywebpack-cli\lib\builder.js:
87:13)
    at Object.exports.build (D:\lab\easywebpack\01\node_modules\easywebpack-cli\
lib\builder.js:100:10)
    at Command.program.command.description.action.env (D:\lab\easywebpack\01\nod
e_modules\easywebpack-cli\bin\cli.js:108:13)
    at Command.listener (D:\lab\easywebpack\01\node_modules\commander\index.js:3
15:8)
    at emitTwo (events.js:126:13)
    at Command.emit (events.js:214:7)
    at Command.parseArgs (D:\lab\easywebpack\01\node_modules\commander\index.js:

@Zohner 已自带watch了,你这个不加watch ,是否可以正常编译?

@hubcarl 可以,但只编译一次,我需要的效果是监听文件自动构建prod模式

为什么prod 监听? prod 构建只直接落地磁盘的,监听模式只在 dev 模式有效

@Zohner 这个问题估计是当时 cli 重构时 env 默认设置了 prod 导致的, 你可以再验证一下看看

问题依然存在,无法用上watch自动构建,这个什么时候能够修复下 @hubcarl

同问几时能修复?