-
Notifications
You must be signed in to change notification settings - Fork 363
Conversation
🆒 |
有什么问题,呼叫我就可以了😀 |
这是是build以后chokidar只存在remax-cli包里边,但是rollup 取得包是当前这个node_modules,地址:https://github.com/rollup/rollup/blob/cc5fd63d9a612d61499c3b7e8ee97957422856a8/src/watch/chokidar.ts#L7 |
哦,那可以把 chokidar 取出来 https://github.com/remaxjs/remax/blob/master/packages/remax-cli/src/build/rollupConfig.ts#L140 |
dedupe 这个是如果root有的话就默认加载root下边的node_module包,而不用直接加载自己node_module的包。而且watch实在rullop build之前做的,所以得直接将这个包弄出来,你有什么其他的解决方案吗? |
这个 debupe 是编译小程序的时候用的,不应该影响 remax-cli 的运行才对。 |
哦是的 |
看样子后边会更新这个问题,现在是等rollup更新还是在加载的时候自动添加chokidor这个包吗?目前没有想到其他的好的方式了 |
在脚手架里把他加到开发依赖? |
现在rollup取chokidar包的时候是取的root node_modules下边的包,remax cli 是下载自己的node_modules下边,好像配置不到root node_modules下边 |
嗯,所以我意思在脚手架里让开发者安装 chokidar |
是版本不匹配吗? |
是 rollup 取 chokidar 的问题 |
|
监听 native 文件 OK。
|
报错那个是我做了验证,因为不提示感觉如果是路径问题排查错误不好找,这个验证可以去掉 刚才你提到的说重新build说是因为他不属于import一部分,所以无法做到只编译部分的。像native部分是全部的依赖,不得不重新rebuild。不知道我的想法有没有问题。 |
哦,很合理。 所以删掉 entry 只是提示,打包是成功的? |
会断掉用的throw的。如果只是提示的话可以改一下,我觉得build如果没找到依赖应该算是错误,其实都合理。 |
这个相当于是把entry删掉了,我们可以不报错,至于没有对应的页面路径,小程序会有报错提示 |
那就改成 warning的那种方式,只是提醒就可以吗? |
不用 warning,console.log 就行 |
|
@Crayonn 你现在想怎么做? |
@Darmody 我想了一下,可以按照yesmeck说的做,如果没有就不使用chokidar,我们可以提示一下告诉如果用chikodar体验会更好,这样可以不。 |
OK |
@Darmody 好了,你看看这样改可以吗?😆 |
} catch (e) { | ||
console.log(e); | ||
console.log( | ||
'\nIf you install `chokidar`, you will be a better development experience! 😎' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
就写中文吧,开发小程序的基本上就是中文开发者了。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
好👌
require(path.resolve(process.cwd(), './node_modules/chokidar')); | ||
return true; | ||
} catch (e) { | ||
console.log('\n 如果下载 `chokidar`,会有更好的开发体验~~ 😎'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
安装 `chokidar` 获得更好的开发体验~~😎
> npm install chokidar --save
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
好的
@yesmeck OK 吗 |
好像新增页面不行,新增的页面不会被编译。 |
你有修改pages吗? |
需要添加到config文件中就可以了 |
重新 watch 的时候得重新获取 rollupConfig 才行,不然里面的 entries 还是旧的 |
不对,好像是多 runWatch 几次会 OOM。 |
在 app.config.js 里新增、删除 page,多来几次就 OOM 了。 |
436de61
to
9908c4f
Compare
我试了下没有泄露了 就是额外监听的文件需要重新 build 体验上有点差,后面再想想办法吧 |
我最近我也在想有什么更好的方式处理这个问题 |
不好意思,更新晚了,现在extraFiles数组可以添加文件的配置,这部分的watch是要重新build的,把需要的监听文件放进去就可以了