Hi,
I observed that hot-module-replacement is super slow in my React+Mui6 demo project, once I update to 3.0.3. You can find my repo here https://github.com/bratelefant/simple-app. Simply run it via meteor run
.
I currently downgraded to 2.16. Here, HMR takes less than a second. After a simple meteor update
, HMR takes ~7 secs to display changes (eg. add a single character to Dummy.jsx
) in the browser.
When I use METEOR_PROFILE=20 meteor run
, I get approximately the same rebuild times as in 2.16 or even better.
Is this a know issue?
Here’s some profiling, this is from 2.16
(#8) Profiling: ProjectContext prepareProjectForBuild
|
| ProjectContext prepareProjectForBuild............................45 ms (1)
| └─ _downloadMissingPackages......................................38 ms (1)
| └─ Isopack.readMetadataFromDirectory 23 ms (86)
|
| Top leaves:
|
| (#8) Total: 45 ms (ProjectContext prepareProjectForBuild)
|
| (#9) Profiling: Rebuild App
|
| Rebuild App...................................................1,704 ms (1)
| └─ bundler.bundle.............................................1,704 ms (1)
| ├─ compiler.compile(the app).................................417 ms (1)
| │ └─ compileUnibuild (the app) 417 ms (4)
| ├─ bundler.bundle..makeClientTarget........................1,250 ms (2)
| │ └─ Target#make..........................................1,250 ms (2)
| │ ├─ Target#_emitResources.............................1,059 ms (2)
| │ │ ├─ PackageSourceBatch.computeJsOutputFilesMap.....1,022 ms (2)
| │ │ │ └─ ImportScanner#scanImports for the app.........939 ms (2)
| │ │ │ ├─ ImportScanner#resolve 189 ms (82390)
| │ │ │ ├─ ImportScanner#getAbsModuleId 50 ms (22984)
| │ │ │ ├─ ImportScanner#realPath 210 ms (22984)
| │ │ │ ├─ ImportScanner#readFile 47 ms (22984)
| │ │ │ ├─ DefaultHandlers.js.........................106 ms (22984)
| │ │ │ │ ├─ reifyCompileWithCache 33 ms (22984)
| │ │ │ │ └─ other DefaultHandlers.js 74 ms
| │ │ │ └─ other ImportScanner#scanImports for the app 321 ms
| │ │ └─ PackageSourceBatch#getResources...................23 ms (135)
| │ │ └─ PackageSourceBatch#_linkJS 22 ms (135)
| │ ├─ Target#minifyJs......................................83 ms (2)
| │ │ └─ sha512 82 ms (137)
| │ └─ sha512 82 ms (139)
| └─ bundler writeTargetToPath..................................22 ms (2)
| └─ ClientTarget#write 22 ms (2)
|
| Top leaves:
| other ImportScanner#scanImports for the app................321 ms (2)
| ImportScanner#realPath.....................................213 ms (23518)
| sha512.....................................................164 ms (290)
|
| (#9) Total: 1,704 ms (Rebuild App)
This is from 3.0.3
| (#6) Profiling: ProjectContext prepareProjectForBuild
|
| ProjectContext prepareProjectForBuild 1 ms (1)
|
| Top leaves:
|
| (#6) Total: 1 ms (ProjectContext prepareProjectForBuild)
|
| (#7) Profiling: Rebuild App
|
| Rebuild App 11 ms (1)
| Isopack#getUnibuildAtArch 5 ms (5998)
| Isopack#ensurePluginsInitialized 0 ms (399)
| PackageSource#_findSources for os 2 ms (1)
| files.realpath 0 ms (4)
| files.readdirWithTypes 0 ms (4)
| optimistic readFile 0 ms (1)
| safeWatcher.watch 0 ms (1)
| compileUnibuild (the app) 0 ms (3)
| PackageSource#_findSources for web.browser 1 ms (1)
| PackageSource#_findSources for web.browser.legacy 1 ms (1)
| PackageSource#_findSources for web.cordova 1 ms (1)
| compiler.lint(the app) 0 ms (1)
| bundler.bundle..makeClientTarget 0 ms (2)
| Target#_runCompilerPlugins 0 ms (2)
| plugin ecmascript 1 ms (2)
| plugin typescript 6 ms (2)
| plugin static-html 1 ms (2)
| plugin meteor 0 ms (2)
| Target#_emitResources 1 ms (2)
| sha1 14 ms (1891)
| files.stat 1 ms (94)
| ImportScanner#getAbsModuleId 51 ms (24204)
| ImportScanner#realPath 220 ms (24204)
| ImportScanner#scanImports for modules 0 ms (2)
| ImportScanner#findImportedModuleIdentifiers 15 ms (23752)
| jsAnalyze.parse 86 ms (178)
| findImportedModuleIdentifiersVisitor 5 ms (178)
| ImportScanner#resolve 203 ms (84320)
| ImportScanner#readFile 47 ms (23528)
| DefaultHandlers.js 62 ms (23526)
| reifyCompileWithCache 32 ms (23046)
| ImportScanner#scanImports for es5-shim 0 ms (2)
| ImportScanner#scanImports for modern-browsers 0 ms (2)
| ImportScanner#scanImports for promise 0 ms (2)
| ImportScanner#scanImports for ecmascript-runtime-client 0 ms (2)
| ImportScanner#scanImports for hot-module-replacement 0 ms (2)
| ImportScanner#scanImports for react-fast-refresh 0 ms (2)
| ImportScanner#scanImports for babel-runtime 0 ms (2)
| ImportScanner#scanImports for fetch 0 ms (2)
| ImportScanner#scanImports for dynamic-import 0 ms (2)
| ImportScanner#scanImports for base64 0 ms (2)
| Babel.compile 7 ms (168)
| ImportScanner#scanImports for ejson 0 ms (2)
| ImportScanner#scanImports for diff-sequence 0 ms (2)
| ImportScanner#scanImports for geojson-utils 0 ms (2)
| ImportScanner#scanImports for id-map 0 ms (2)
| ImportScanner#scanImports for random 0 ms (2)
| ImportScanner#scanImports for mongo-id 0 ms (2)
| ImportScanner#scanImports for ordered-dict 0 ms (2)
| ImportScanner#scanImports for tracker 0 ms (2)
| ImportScanner#scanImports for minimongo 0 ms (2)
| ImportScanner#scanImports for check 0 ms (2)
| ImportScanner#scanImports for retry 0 ms (2)
| ImportScanner#scanImports for callback-hook 0 ms (2)
| ImportScanner#scanImports for ddp-common 0 ms (2)
| ImportScanner#scanImports for reload 0 ms (2)
| ImportScanner#scanImports for socket-stream-client 0 ms (2)
| ImportScanner#scanImports for ddp-client 0 ms (2)
| ImportScanner#scanImports for allow-deny 0 ms (2)
| ImportScanner#scanImports for mongo-dev-server 0 ms (2)
| ImportScanner#scanImports for logging 0 ms (2)
| ImportScanner#scanImports for mongo 0 ms (2)
| ImportScanner#scanImports for minifier-css 0 ms (2)
| ImportScanner#scanImports for react-meteor-data 0 ms (2)
| ImportScanner#scanImports for dev-error-overlay 0 ms (2)
| ImportScanner#scanImports for ddp-rate-limiter 0 ms (2)
| ImportScanner#scanImports for url 0 ms (2)
| ImportScanner#scanImports for accounts-base 0 ms (2)
| ImportScanner#scanImports for accounts-password 0 ms (2)
| ImportScanner#scanImports for oauth 0 ms (2)
| ImportScanner#scanImports for accounts-oauth 0 ms (2)
| ImportScanner#scanImports for service-configuration 0 ms (2)
| ImportScanner#scanImports for oauth2 0 ms (2)
| ImportScanner#scanImports for github-oauth 0 ms (2)
| ImportScanner#scanImports for accounts-github 0 ms (2)
| ImportScanner#scanImports for webapp 0 ms (2)
| ImportScanner#scanImports for autoupdate 0 ms (2)
| ImportScanner#scanImports for the app 0 ms (2)
| files.readFile 2 ms (4)
| ImportScanner#scanMissingModules for the app 0 ms (4)
| DefaultHandlers.json 0 ms (2)
| ImportScanner#scanMissingModules for modules 0 ms (2)
| ImportScanner#scanMissingModules for ejson 0 ms (2)
| ImportScanner#scanMissingModules for random 0 ms (2)
| ImportScanner#scanMissingModules for callback-hook 0 ms (2)
| ImportScanner#scanMissingModules for mongo-id 0 ms (2)
| ImportScanner#scanMissingModules for ddp-common 0 ms (2)
| ImportScanner#scanMissingModules for socket-stream-client 0 ms (2)
| ImportScanner#scanMissingModules for minimongo 0 ms (2)
| ImportScanner#scanMissingModules for logging 0 ms (2)
| ImportScanner#scanMissingModules for react-meteor-data 0 ms (2)
| ImportScanner#scanMissingModules for retry 0 ms (2)
| PackageSourceBatch._watchOutputFiles 18 ms (2)
| PackageSourceBatch#getResources 14 ms (137)
| linker File#getPrelinkedOutput 0 ms (2)
| Target#minifyJs..................................................37 ms (2)
| └─ sha512 36 ms (139)
| ClientTarget#minifyCss 0 ms (2)
| createCacheKey 0 ms (2)
| watchAndHashDeps 0 ms (1)
| Target#rewriteSourceMaps 0 ms (2)
| sha512 36 ms (153)
| bundler writeTargetToPath 0 ms (2)
| ClientTarget#write 0 ms (2)
| bundler writeFile 0 ms (153)
| Builder#_ensureDirectory 0 ms (153)
| Builder#write 3 ms (70)
| files.writeFile 0 ms (2)
| files.rename 0 ms (2)
| Builder#complete 0 ms (2)
|
| Top leaves:
|
| (#7) Total: 887 ms (Rebuild App)