weixin_39637370
weixin_39637370
2020-11-26 02:56

Compilation problems

Hi, I've switched up from 0.57.0 to the 0.59.0 release. - Compilation became really slow, previously instantaneous on ctrl+s, now can easily take 20/30s first time and never end afterwards. - Even with a compilation of the project (ctrl+shift+b) the problem still occur.

Node seems to take much CPU resources in the meanwhile.

Could you help to investigate what is going wrong with the new version?

Thanks in advance for your help

该提问来源于开源项目:TypeStrong/atom-typescript

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享
  • 邀请回答

13条回答

  • weixin_39807859 weixin_39807859 5月前

    thanks for raising this. To help us narrow out the possible causes can you completely disable chokidar. I.e. comment out the entire body of watchProjectFile so that we have:

     ts
    function watchProjectFile(projectFile: tsconfig.TypeScriptProjectFileDetails) {
        /*if (watchingProjectFile[projectFile.projectFilePath]) return; // Only watch once
    
        var watcher = chokidar.watch(projectFile.projectFilePath, { ignoreInitial: true, persistent: true });
        watchingProjectFile[projectFile.projectFilePath] = watcher;
    
        function clear(datPathYo) {
            // TODO : Invalidate only matching caches for projectFilePath
            // Right now: Just invalidate *all*
            projectByProjectPath = {};
            projectByFilePath = {};
        }
    
        watcher.on('change', clear)
            .on('unlink', clear);*/
    }
    

    and see if it fixes it.

    点赞 评论 复制链接分享
  • weixin_39807859 weixin_39807859 5月前

    see if v0.63.0 fixes it. I suspect it will as it has a much more stable node worker :heart:

    点赞 评论 复制链接分享
  • weixin_39637370 weixin_39637370 5月前

    Thank you for your response.

    I've tried the 0.63.0 release but it appears that problem still occurs.

    Then I've tried your suggestion and completely disabled chokidar integration. For now my problem seems not reproducible, so it appears that your assumption is correct. I will update my answer if things went wrong again.

    点赞 评论 复制链接分享
  • weixin_39807859 weixin_39807859 5月前

    note to self: if it really does boil down to chokidar we could just reload hard refresh tsconfig cache from disk on save.

    点赞 评论 复制链接分享
  • weixin_39722188 weixin_39722188 5月前

    I see some stack traces pointing to atom-typescript via chokidar when saving files that are not TypeScript files and not in projects that should be touched by atom-typescript. From the stack trace it looks like it’s hooked itself into several of the fs methods, so any time atom-typescript is active and a filesystem error occurs, it’s going to get reported as being the fault of atom-typescript. (In my case, https://github.com/atom/atom/issues/4467 is the real bug.) Seems like this is probably not…desirable.

    点赞 评论 复制链接分享
  • weixin_39807859 weixin_39807859 5月前

    Alright I've moved this to the top of my queue. Will remove the chokidar dependency and make sure not to break this https://github.com/TypeStrong/atom-typescript/issues/83

    点赞 评论 复制链接分享
  • weixin_39807859 weixin_39807859 5月前

    pushed in v0.67.0. please comment / reopen if you still have issues

    点赞 评论 复制链接分享
  • weixin_39767386 weixin_39767386 5月前

    hi , I think this issue persists with 5.4.2.

    This plugin was working brilliantly until I tried adding gulp build workflow. It started showing thousands of error and still counting up, also blocks and fills some process queue (either atom's or atom-typescript's, not sure). Errors are about duplicate definitions shown at the lib.d.ts etc. files in node_modules/gulp-tsc/, which I guess contains an typescript module dependecny in it.

    Here is my tsconfig.json:

     json
    {
        "compilerOptions": {
            "removeComments": false,
            "sourceMap": true,
            "target": "es5",
            "module": "commonjs",
            "outDir": "app/dist/js"
        },
        "fileGlob": "app/src/**/*.ts"
    }
    

    and package.json:

     json
    {
      "version": "0.0.0",
      "description": "",
      "main": "Gulpfile.js",
      "dependencies": {},
      "devDependencies": {
        "gulp": "^3.9.0",
        "gulp-plumber": "^1.0.1",
        "gulp-sass": "^2.0.4",
        "gulp-tsc": "^1.1.0",
        "gulp-uglify": "^1.2.0"
      }
    }
    

    Am I doing something wrong? Is there a recommended way to have typescript compilation in gulp build process?

    点赞 评论 复制链接分享
  • weixin_39807859 weixin_39807859 5月前

    if yo can provide the repo I'd be happy to debug it deeply. Also feel free to create a new issue specific to you problem 🌹

    点赞 评论 复制链接分享
  • weixin_39767386 weixin_39767386 5月前

    Thank you for your concern. This is a bit embarrassing but tried re-adding "gulp-tsc" back (prior to that, I have switched backed to atom-typescript compilation via tsconfig.json) but I couldn't reproduce the problem. So good news is it now works fine. I did a clean atom reinstall including $HOME/.atom maybe it did the trick.

    If such a thing occurs again, I'd be coming back with concrete examples so it could be debugged.

    Thanks again.

    点赞 评论 复制链接分享
  • weixin_39807859 weixin_39807859 5月前

    no worries :rose:

    点赞 评论 复制链接分享
  • weixin_39637370 weixin_39637370 5月前

    After some restarts compile on save feature seems to be working again as intended, sorry for the inconvenience.

    点赞 评论 复制链接分享
  • weixin_39807859 weixin_39807859 5月前

    Two possible causes:

    Invalid tsconfig file. Causes the worker to crash silently. Needs error reporting to user.

    Chokidar file watching can perform bad sometimes (historically). No idea why though.

    点赞 评论 复制链接分享

相关推荐