I have a fairly comprehensive Meteor app. I find that I need to restart meteor quite often because the build time gradually increases after each code change.
For example, when running with METEOR_PROFILE=100, this is what a code change looks like shortly after running…
| (#8) Profiling: ProjectContext prepareProjectForBuild
| Preparing to build package oauth |
| ProjectContext prepareProjectForBuild...........................587 ms (1)
| └─ _downloadMissingPackages 484 ms (1)
|
| Top leaves:
|
| (#8) Total: 587 ms (ProjectContext prepareProjectForBuild)
|
| (#9) Profiling: Rebuild App |
| /
| Rebuild App...................................................2,317 ms (1)
| └─ bundler.bundle.............................................2,317 ms (1)
| └─ files.withCache.........................................2,317 ms (1)
| ├─ compiler.compile(the app)..............................123 ms (1)
| │ └─ files.withCache.....................................123 ms (3)
| │ └─ compileUnibuild (the app) 123 ms (3)
| ├─ bundler.bundle..makeClientTarget.....................1,630 ms (1)
| │ └─ Target#make.......................................1,630 ms (1)
| │ ├─ Target#_emitResources..........................1,394 ms (1)
| │ │ ├─ PackageSourceBatch.computeJsOutputFilesMap..1,000 ms (1)
| │ │ │ └─ ImportScanner#scanImports for the app......949 ms (1)
| │ │ │ ├─ Babel.compile 228 ms (105)
| │ │ │ └─ other ImportScanner#scanImports for the app 435 ms
| │ │ └─ PackageSourceBatch#getResources...............386 ms (82)
| │ │ └─ PackageSourceBatch#_linkJS.................386 ms (82)
| │ │ └─ linker.fullLink.........................336 ms (1)
| │ │ └─ linker Module#getPrelinkedFiles......335 ms (1)
| │ │ └─ getPrelinkedFiles toStringWithSourceMap 314 ms (1)
| │ └─ Target#minifyJs 155 ms (1)
| ├─ bundler.bundle..makeServerTarget.......................102 ms (1)
| │ └─ Target#make 102 ms (1)
| └─ bundler writeSiteArchive...............................457 ms (1)
| └─ bundler writeTargetToPath...........................455 ms (2)
| ├─ ClientTarget#write...............................181 ms (1)
| │ └─ bundler writeFile 141 ms (108)
| └─ ServerTarget#write...............................273 ms (1)
| └─ JsImage#write.................................271 ms (1)
| └─ Builder#copyNodeModulesDirectory 170 ms (27)
|
| Top leaves:
| other ImportScanner#scanImports for the app................435 ms (1)
| getPrelinkedFiles toStringWithSourceMap....................314 ms (1)
| Babel.compile..............................................239 ms (289)
|
| (#9) Total: 2,317 ms (Rebuild App)
|
And here it is many code changes later…
| (#114) Profiling: ProjectContext prepareProjectForBuild
| \
| ProjectContext prepareProjectForBuild.........................5,952 ms (1)
| ├─ _initializeCatalog...........................................747 ms (1)
| │ ├─ LocalCatalog#initialize...................................548 ms (1)
| │ │ └─ LocalCatalog#_loadLocalPackages 471 ms (1)
| │ └─ other _initializeCatalog 199 ms
| ├─ _resolveConstraints 132 ms (1)
| ├─ _downloadMissingPackages 4,604 ms (1)
| └─ _buildLocalPackages..........................................393 ms (1)
| ├─ _ensurePackageLoaded(accounts-oidc) 166 ms (1)
| └─ other _buildLocalPackages 120 ms
|
| Top leaves:
| other _initializeCatalog...................................199 ms (1)
| other _buildLocalPackages..................................120 ms (1)
|
| (#114) Total: 5,952 ms (ProjectContext prepareProjectForBuild)
|
| (#115) Profiling: Rebuild App \
| -
| Rebuild App...................................................2,780 ms (1)
| └─ bundler.bundle.............................................2,780 ms (1)
| └─ files.withCache.........................................2,780 ms (1)
| ├─ compiler.compile(the app)..............................374 ms (1)
| │ └─ files.withCache.....................................374 ms (3)
| │ └─ compileUnibuild (the app) 374 ms (3)
| ├─ bundler.bundle..makeClientTarget.....................1,045 ms (1)
| │ └─ Target#make.......................................1,045 ms (1)
| │ ├─ Target#_runCompilerPlugins 252 ms (1)
| │ ├─ Target#_emitResources............................473 ms (1)
| │ │ └─ PackageSourceBatch.computeJsOutputFilesMap....450 ms (1)
| │ │ └─ ImportScanner#scanImports for the app......396 ms (1)
| │ │ ├─ ImportScanner#_realPath 121 ms (4601)
| │ │ └─ other ImportScanner#scanImports for the app 105 ms
| │ └─ Target#minifyJs 202 ms (1)
| ├─ bundler.bundle..makeServerTarget.......................675 ms (1)
| │ └─ Target#make.........................................675 ms (1)
| │ ├─ Target#_runCompilerPlugins 359 ms (1)
| │ └─ other Target#make 188 ms
| ├─ bundler writeSiteArchive...............................496 ms (1)
| │ └─ bundler writeTargetToPath...........................493 ms (2)
| │ ├─ ClientTarget#write...............................196 ms (1)
| │ │ └─ bundler writeFile 148 ms (108)
| │ └─ ServerTarget#write...............................297 ms (1)
| │ └─ JsImage#write.................................295 ms (1)
| │ └─ Builder#copyNodeModulesDirectory 190 ms (27)
| └─ other files.withCache 189 ms
|
| Top leaves:
| other Target#make..........................................279 ms (2)
| other files.withCache......................................189 ms (4)
| plugin ecmascript..........................................126 ms (2)
| Isopack#getUnibuildAtArch..................................116 ms (6010)
| other ImportScanner#scanImports for the app................105 ms (1)
|
| (#115) Total: 2,780 ms (Rebuild App)
Nothing has changed in terms of packages, but it now takes nearly eight times as long to run the _downloadMissingPackages
command.
Any idea how I can fix this?
Meteor version: 1.8.0.2
OS: macOS Mojave
Thanks in advance.