每次修改node_modules里的代码后就要手动来点一次

请教有没有快捷的方式呢?
如果有像 curl http://localhost:7456/asset-db/refresh 可以从外部触发的就更好了…
请教引擎组的各位 @max @dumganhar
每次修改node_modules里的代码后就要手动来点一次

请教有没有快捷的方式呢?
如果有像 curl http://localhost:7456/asset-db/refresh 可以从外部触发的就更好了…
请教引擎组的各位 @max @dumganhar
你 node_modules 里面放了什么代码?为什么会在那边频繁修改?
目前没有 http 请求的方法,只有 ipc 消息,类似这样。
Editor.Message.send(‘programming’,‘clear-code-cache’)
感谢回覆,
我在node_modules里面放了编译好的公用类库,
多人协作的时候,经由tsc建置好存放到node_modules里去
理解,那我再想想别的办法好了
不晓得能不能插件写个http server来响应…哈
可以看看插件系统,理论上用http响应是没问题的
好的,感谢您的回答
写一下目前的解决办法,先建立一个新的插件,
然后在main.ts里修改…
import http from 'http'
let server: http.Server
export function load()
{
server = http.createServer( async ( req, res ) =>
{
if( req.method === 'GET' && req.url === '/refresh' )
{
await Editor.Message.send( 'programming', 'clear-code-cache' )
res.writeHead( 200, { 'Content-Type': 'text/plain' } )
res.end( 'ok' );
}
else {
res.writeHead( 404, { 'Content-Type': 'text/plain' } )
res.end( 'Not Found' );
}
} )
server.listen( 7638, () => {
console.log( 'Server listening on port 7638' );
} );
}
export function unload()
{
if( server != null ) server.close()
}
因为是nodejs环境,有内建的http可以用,
记得npm run build一下,再启用插件
这样其他人只要用 curl http://机器IP:7638/refresh
就可以自动刷新了
谢谢 @max 提供的资讯,再次感谢