meteor / meteor-feature-requests

A tracker for Meteor issues that are requests for new functionality, not bugs.
Other
89 stars 3 forks source link

Use of esbuild to decrease build and rebuild time #398

Open linegel opened 4 years ago

linegel commented 4 years ago

I just played around for few hours with esbuild and WOAH that's really impressive thing Usage of it could really kill that years-long hassle with building and rebuilding of the project, we all struggling with it and that's one of the main disadvantages for the usage of Meteor in a big project.

The main problem looks like it could be a real mess to get into this. As the first step of integration, I see that we could use esbuild instead of current minifier (in my projects it takes around or sometimes more than 50% of the time during building stage). Then we can have a look at how we could move forward with all that we have in isobuild. It would be really nice to have a response from somebody who has worked with Meteor building process previously and who could give a tip where from I could start work on PoC

linegel commented 4 years ago

@filipenevola any ideas about who could help us to start work on it?

hexsprite commented 4 years ago

@linegel yes, I think you could start by trying to integrate this as a minifier plugin, this doesn't require any changes to Meteor core.

StorytellerCZ commented 4 years ago

@linegel the person who knows the build system the most probably is @benjamn and @zodern.

crapthings commented 3 years ago

what about this one?

https://swc.rs/

https://deno.land/manual@v1.10.3/typescript/overview#how-does-it-work

At a high level, Deno converts TypeScript (as well as TSX and JSX) into JavaScript. It does this via a combination of the TypeScript compiler, which we build into Deno, and a Rust library called swc. When the code has been type checked and transformed, it is stored in a cache, ready for the next run without the need to convert it from its source to JavaScript again.

and parcel 2b3 seems use swc

https://v2.parceljs.org/blog/beta3/

benjamn commented 3 years ago

@linegel As @crapthings mentioned above, the SWC project aims to be a drop-in replacement for Babel (or at least as much of a drop-in replacement as possible when using a different programming language), reimplementing many of its transforms, which means SWC could potentially replace/reimplement the meteor-babel package, with relatively few visible changes to existing Meteor applications (beyond some new complexities with .babelrc files, perhaps).

Using SWC in this way seems especially appealing because Babel often takes up so much time (50%+) during initial (cold start) meteor builds. I think it would be wise to start with this approach, if only to see how much of an improvement it can provide, before considering deeper changes.

Note: I'm not actively working on Meteor these days, and I don't speak for the current team, but I wanted to express my relative confidence in the SWC-instead-of-Babel approach, compared to a blind replacement of the whole build system (using esbuild or any other toolchain).

afrokick commented 3 years ago

Meteor works with es5, ESBuild supports only ES6+.

jpambrun commented 3 years ago

We wrote a minifier plugin using esbuild instead of terser. That reduced our build time by about 50% and we even managed to remove Meteor.isServer() blocks from client bundles.

There is definitely something to do with esbuild and/or swc.

On Tue, Jun 8, 2021, 3:53 AM Alex Sosnovskiy @.***> wrote:

Meteor works with es5, ESBuild supports only ES6+.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/meteor/meteor-feature-requests/issues/398#issuecomment-856544606, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAFPMMASASNDU3W3N75KWUDTRXD65ANCNFSM4MYBNP5A .

StorytellerCZ commented 3 years ago

Maybe something to consider for Meteor 3 or 4.

harryadel commented 3 years ago

@jpambrun Can you please create a mini repo illustrating how you've managed to do it? Or even preferably a package?

jpambrun commented 3 years ago

@jpambrun Can you please create a mini repo illustrating how you've managed to do it? Or even preferably a package?

I am seeking approval.. might take a while..

harryadel commented 3 years ago

@jpambrun Thanks a lot!

lscoder commented 3 years ago

I created a test to compare terser (faster than babel) and esbuild minifying 218 files (41MB) and esbuild (1.4s) is 46x faster than terser (65s). The final bundle had almost the same size.

crapthings commented 3 years ago

first clone these packagess in your project/packages

  esbuild = esbuild || Npm.require('esbuild');
  result.code = esbuild.transformSync(source, {
    minify: true,
  }).code;
  result.minifier = 'esbuild';
  return result;

image

image

after replace i don't see performance boost with our project, weird. or should i meteor reset before build?

meteor build --directory --server-only ../build-new-minifier6

the total build time almost same like before

MacBook Pro (Retina, 15-inch, Mid 2015)

esbuild

| (#1) Profiling: meteor build
Warning: Nested Profile.run at ProjectContext prepareProjectForBuild
Browserslist: caniuse-lite is outdated. Please run:
npx browserslist@latest --update-db

Why you should do it regularly:
https://github.com/browserslist/browserslist#browsers-data-updating
|                                            -
| files.stat                                                        0 ms (3)
| files.readFile                                                    0 ms (3)
| require("meteor/socket-stream-client")                            1 ms (1)
| Npm.require("faye-websocket")                                    24 ms (1)
| Npm.require("permessage-deflate")                                 3 ms (1)
| meteor build................................................246,030 ms (1)
| ├─ ProjectContext prepareProjectForBuild.....................11,272 ms (1)
| │  ├─ _resolveConstraints.......................................894 ms (1)
| │  │  ├─ bundler.readJsImage....................................218 ms (1)
| │  │  │  └─ meteorNpm.rebuildIfNonPortable......................192 ms (16)
| │  │  │     └─ meteorNpm.isPortable                             142 ms (234)
| │  │  └─ JsImage#load...........................................654 ms (1)
| │  │     ├─ runJavaScript packages/dynamic-import.js............169 ms (1)
| │  │     │  └─ require("/node_modules/meteor/dynamic-import/server.js").168 ms (1)
| │  │     │     └─ require("./security.js")                      166 ms (1)
| │  │     └─ runJavaScript packages/npm-mongo.js.................137 ms (1)
| │  │        └─ Npm.require("mongodb")                           136 ms (1)
| │  └─ _buildLocalPackages....................................10,309 ms (1)
| │     ├─ _ensurePackageLoaded(accounts-base)....................451 ms (1)
| │     │  └─ _ensurePackageLoaded(ecmascript)....................284 ms (1)
| │     │     ├─ IsopackCache Load local isopack..................139 ms (1)
| │     │     │  └─ Isopack#initFromPath..........................139 ms (1)
| │     │     │     └─ bundler.readJsImage........................137 ms (1)
| │     │     │        └─ meteorNpm.rebuildIfNonPortable..........134 ms (8)
| │     │     │           └─ meteorNpm.isPortable                 101 ms (187)
| │     │     └─ _ensurePackageLoaded(babel-compiler)             122 ms (1)
| │     ├─ _ensurePackageLoaded(coagmano:stylus)..................115 ms (1)
| │     │  └─ IsopackCache Load local isopack.....................115 ms (1)
| │     │     └─ Isopack#initFromPath.............................115 ms (1)
| │     │        └─ bundler.readJsImage...........................114 ms (1)
| │     │           └─ meteorNpm.rebuildIfNonPortable             111 ms (10)
| │     ├─ _ensurePackageLoaded(crapthings:minifier-js)...........163 ms (1)
| │     │  └─ IsopackCache Build local isopack....................163 ms (1)
| │     │     └─ Isopack#saveToPath...............................142 ms (1)
| │     │        └─ Builder#copyNodeModulesDirectory              133 ms (1)
| │     ├─ _ensurePackageLoaded(crapthings:standard-minifier-js).8,790 ms (1)
| │     │  └─ IsopackCache Build local isopack..................8,790 ms (1)
| │     │     ├─ compiler.compile(crapthings:standard-minifier-js).1,329 ms (1)
| │     │     │  ├─ bundler.buildJsImage........................1,195 ms (1)
| │     │     │  │  ├─ compiler.compile(minifyStdJS)              101 ms (1)
| │     │     │  │  └─ Target#make..............................1,094 ms (1)
| │     │     │  │     └─ Target#_emitResources.................1,086 ms (1)
| │     │     │  │        ├─ PackageSourceBatch.computeJsOutputFilesMap.967 ms (1)
| │     │     │  │        │  └─ ImportScanner#scanImports for minifyStdJS.866 ms (1)
| │     │     │  │        │     ├─ Npm.require("meteor-babel")    284 ms (1)
| │     │     │  │        │     └─ other ImportScanner#scanImports for minifyStdJS 563 ms
| │     │     │  │        └─ PackageSourceBatch#getResources......117 ms (17)
| │     │     │  │           └─ PackageSourceBatch#_linkJS........116 ms (17)
| │     │     │  │              └─ linker.fullLink                108 ms (17)
| │     │     │  └─ compileUnibuild (crapthings:standard-minifier-js).133 ms (4)
| │     │     │     └─ Isopack#ensurePluginsInitialized...........128 ms (16)
| │     │     │        └─ JsImage#load                            127 ms (1)
| │     │     └─ Isopack#saveToPath.............................7,453 ms (1)
| │     │        └─ JsImage#write...............................7,444 ms (1)
| │     │           └─ Builder#copyNodeModulesDirectory.........7,414 ms (12)
| │     │              ├─ Builder#_ensureDirectory................392 ms (1160)
| │     │              │  └─ files.stat                           226 ms (3525)
| │     │              ├─ safeWatcher.watch.....................1,153 ms (66942)
| │     │              │  ├─ files.watchFile                      597 ms (66942)
| │     │              │  ├─ files.stat                           174 ms (12928)
| │     │              │  └─ other safeWatcher.watch              381 ms
| │     │              ├─ optimistic lstat........................293 ms (13133)
| │     │              │  └─ files.lstat                          269 ms (13133)
| │     │              ├─ files.stat                              167 ms (11977)
| │     │              ├─ optimistic hashOrNull.................1,083 ms (12165)
| │     │              │  ├─ optimistic readFile..................622 ms (12165)
| │     │              │  │  └─ files.readFile                    592 ms (12165)
| │     │              │  ├─ sha1                                 205 ms (12165)
| │     │              │  └─ other optimistic hashOrNull          162 ms
| │     │              ├─ optimistic readFile.....................490 ms (12178)
| │     │              │  └─ files.readFile                       468 ms (12178)
| │     │              ├─ files.writeFile                       2,035 ms (12249)
| │     │              ├─ optimistic readdir......................215 ms (1131)
| │     │              │  └─ files.readdir                        212 ms (1131)
| │     │              └─ other Builder#copyNodeModulesDirectory 1,528 ms
| │     ├─ _ensurePackageLoaded(standard-minifier-css)............202 ms (1)
| │     │  └─ IsopackCache Load local isopack.....................202 ms (1)
| │     │     └─ Isopack#initFromPath.............................202 ms (1)
| │     │        └─ bundler.readJsImage...........................201 ms (1)
| │     │           └─ meteorNpm.rebuildIfNonPortable.............194 ms (12)
| │     │              └─ meteorNpm.isPortable                    157 ms (311)
| │     └─ _ensurePackageLoaded(typescript).......................130 ms (1)
| │        └─ IsopackCache Load local isopack.....................130 ms (1)
| │           └─ Isopack#initFromPath.............................129 ms (1)
| │              └─ bundler.readJsImage...........................128 ms (1)
| │                 └─ meteorNpm.rebuildIfNonPortable             124 ms (8)
| └─ bundler.bundle...........................................234,688 ms (1)
|    ├─ compiler.compile(the app)...............................6,915 ms (1)
|    │  └─ compileUnibuild (the app)............................6,914 ms (4)
|    │     ├─ Isopack#ensurePluginsInitialized..................1,627 ms (64)
|    │     │  └─ JsImage#load...................................1,625 ms (4)
|    │     │     ├─ runJavaScript packages/ecmascript-runtime.js..178 ms (4)
|    │     │     │  └─ require("./node_modules/meteor/ecmascript-runtime/runtime.js").177 ms (1)
|    │     │     │     └─ require("meteor-ecmascript-runtime")    177 ms (1)
|    │     │     ├─ runJavaScript packages/caching-compiler.js....126 ms (2)
|    │     │     │  └─ require("./node_modules/meteor/caching-compiler/caching-compiler.js") 100 ms (1)
|    │     │     ├─ runJavaScript packages/minifier-css.js........267 ms (1)
|    │     │     │  └─ require("/node_modules/meteor/minifier-css/minifier.js").264 ms (1)
|    │     │     │     └─ require("/node_modules/meteor/minifier-css/node_modules/cssnano/dist/index.js") 214 ms (1)
|    │     │     ├─ runJavaScript packages/http.js................215 ms (1)
|    │     │     │  └─ require("/node_modules/meteor/http/httpcall_server.js").214 ms (1)
|    │     │     │     └─ require("request")                      213 ms (1)
|    │     │     └─ runJavaScript packages/compileStylusBatch_plugin.js.443 ms (1)
|    │     │        └─ require("/node_modules/meteor/compileStylusBatch/plugin/compile-stylus.js").440 ms (1)
|    │     │           ├─ Npm.require("stylus")                   231 ms (1)
|    │     │           └─ Npm.require("autoprefixer-stylus")      197 ms (1)
|    │     ├─ PackageSource#_findSources for os.................2,258 ms (1)
|    │     │  ├─ _realpath........................................151 ms (3941)
|    │     │  │  └─ files.lstat                                   109 ms (3941)
|    │     │  ├─ shouldWatch                                      132 ms (3803)
|    │     │  ├─ files.readdirWithTypes                           359 ms (7870)
|    │     │  ├─ optimistic readJsonOrNull........................985 ms (3802)
|    │     │  │  ├─ safeWatcher.watch                             209 ms (6874)
|    │     │  │  ├─ optimistic readFile...........................632 ms (3802)
|    │     │  │  │  └─ files.readFile                             620 ms (3802)
|    │     │  │  └─ other optimistic readJsonOrNull               144 ms
|    │     │  └─ other PackageSource#_findSources for os          530 ms
|    │     ├─ safeWatcher.watch                                   178 ms (13755)
|    │     ├─ optimistic readFile.................................871 ms (6723)
|    │     │  └─ files.readFile                                   858 ms (6723)
|    │     ├─ optimistic hashOrNull...............................544 ms (6724)
|    │     │  ├─ optimistic readFile..............................301 ms (6724)
|    │     │  │  └─ files.readFile                                290 ms (6724)
|    │     │  └─ sha1                                             132 ms (6724)
|    │     ├─ PackageSource#_findSources for web.browser          348 ms (1)
|    │     └─ other compileUnibuild (the app)                     992 ms
|    ├─ bundler.bundle..makeClientTarget......................179,002 ms (3)
|    │  └─ Target#make........................................179,001 ms (3)
|    │     ├─ Target#_runCompilerPlugins........................1,423 ms (3)
|    │     │  └─ plugin coagmano:stylus                         1,178 ms (3)
|    │     ├─ Target#_emitResources............................24,820 ms (3)
|    │     │  ├─ PackageSourceBatch.computeJsOutputFilesMap....23,727 ms (3)
|    │     │  │  ├─ ImportScanner#realPath........................576 ms (7827)
|    │     │  │  │  ├─ safeWatcher.watch                          174 ms (7524)
|    │     │  │  │  └─ other ImportScanner#realPath               303 ms
|    │     │  │  ├─ ImportScanner#scanImports for es5-shim        111 ms (3)
|    │     │  │  ├─ ImportScanner#scanImports for ecmascript-runtime-client.524 ms (3)
|    │     │  │  │  ├─ ImportScanner#findImportedModuleIdentifiers 222 ms (683)
|    │     │  │  │  └─ ImportScanner#resolve                      238 ms (2385)
|    │     │  │  ├─ ImportScanner#scanImports for minimongo.......169 ms (3)
|    │     │  │  │  └─ ImportScanner#findImportedModuleIdentifiers 127 ms (24)
|    │     │  │  ├─ ImportScanner#scanImports for ddp-client      175 ms (3)
|    │     │  │  ├─ ImportScanner#scanImports for jquery..........149 ms (3)
|    │     │  │  │  └─ ImportScanner#findImportedModuleIdentifiers 145 ms (6)
|    │     │  │  ├─ ImportScanner#scanImports for url             177 ms (3)
|    │     │  │  ├─ ImportScanner#scanImports for the app......20,508 ms (3)
|    │     │  │  │  ├─ Babel.compile                            1,521 ms (1905)
|    │     │  │  │  ├─ ImportScanner#findImportedModuleIdentifiers 5,646 ms (6564)
|    │     │  │  │  ├─ ImportScanner#resolve....................6,720 ms (19880)
|    │     │  │  │  │  ├─ files.stat                            2,384 ms (13531)
|    │     │  │  │  │  ├─ safeWatcher.watch.....................2,818 ms (24130)
|    │     │  │  │  │  │  ├─ files.stat                         2,190 ms (12864)
|    │     │  │  │  │  │  ├─ files.watchFile                      353 ms (24130)
|    │     │  │  │  │  │  └─ other safeWatcher.watch              276 ms
|    │     │  │  │  │  └─ other ImportScanner#resolve           1,427 ms
|    │     │  │  │  ├─ ImportScanner#realPath                     419 ms (4839)
|    │     │  │  │  ├─ ImportScanner#readFile.....................689 ms (4650)
|    │     │  │  │  │  ├─ optimistic readFile.....................307 ms (1992)
|    │     │  │  │  │  │  └─ files.readFile                       301 ms (1992)
|    │     │  │  │  │  ├─ optimistic hashOrNull                   169 ms (1992)
|    │     │  │  │  │  └─ other ImportScanner#readFile            165 ms
|    │     │  │  │  ├─ DefaultHandlers.js.........................908 ms (4623)
|    │     │  │  │  │  └─ reifyCompileWithCache...................851 ms (4362)
|    │     │  │  │  │     └─ files.readFile                       796 ms (2997)
|    │     │  │  │  ├─ Npm.require("meteor-babel")                210 ms (1)
|    │     │  │  │  ├─ minifyCssFiles...........................2,871 ms (9)
|    │     │  │  │  │  ├─ CssTools.minifyCss                    2,485 ms (9)
|    │     │  │  │  │  └─ other minifyCssFiles                    352 ms
|    │     │  │  │  └─ other ImportScanner#scanImports for the app 1,369 ms
|    │     │  │  └─ other PackageSourceBatch.computeJsOutputFilesMap 182 ms
|    │     │  ├─ PackageSourceBatch#getResources..................596 ms (237)
|    │     │  │  └─ PackageSourceBatch#_linkJS....................586 ms (237)
|    │     │  │     ├─ files.readFile                             313 ms (237)
|    │     │  │     └─ other PackageSourceBatch#_linkJS           261 ms
|    │     │  └─ other Target#_emitResources                      446 ms
|    │     ├─ Target#minifyJs.................................151,174 ms (3)
|    │     │  ├─ Npm.require("terser")                            291 ms (1)
|    │     │  ├─ Npm.require("meteor-babel")                      219 ms (1)
|    │     │  └─ other Target#minifyJs                        150,562 ms
|    │     └─ ClientTarget#minifyCss............................1,506 ms (3)
|    │        └─ minifyCssFiles.................................1,506 ms (3)
|    │           ├─ mergeCss                                      111 ms (3)
|    │           ├─ CssTools.minifyCss                          1,229 ms (3)
|    │           └─ other minifyCssFiles                          165 ms
|    ├─ bundler.bundle..makeServerTarget........................2,589 ms (1)
|    │  └─ Target#make..........................................2,588 ms (1)
|    │     └─ Target#_emitResources.............................2,549 ms (1)
|    │        └─ PackageSourceBatch.computeJsOutputFilesMap.....2,459 ms (1)
|    │           ├─ ImportScanner#realPath                        157 ms (2240)
|    │           └─ ImportScanner#scanImports for the app.......1,468 ms (1)
|    │              ├─ Babel.compile                              182 ms (219)
|    │              ├─ ImportScanner#findImportedModuleIdentifiers 459 ms (228)
|    │              ├─ ImportScanner#resolve......................676 ms (987)
|    │              │  ├─ files.stat                              247 ms (1310)
|    │              │  ├─ safeWatcher.watch.......................302 ms (2328)
|    │              │  │  └─ files.stat                           212 ms (1083)
|    │              │  └─ other ImportScanner#resolve             118 ms
|    │              └─ other ImportScanner#scanImports for the app 110 ms
|    └─ bundler writeSiteArchive...............................46,155 ms (1)
|       └─ bundler writeTargetToPath...........................46,079 ms (4)
|          ├─ ClientTarget#write................................1,078 ms (3)
|          │  ├─ bundler writeFile................................804 ms (4010)
|          │  │  ├─ Builder#write.................................692 ms (4010)
|          │  │  │  └─ files.writeFile                            610 ms (4008)
|          │  │  └─ other bundler writeFile                       112 ms
|          │  └─ other ClientTarget#write                         117 ms
|          └─ ServerTarget#write...............................44,995 ms (1)
|             └─ JsImage#write.................................44,968 ms (1)
|                ├─ files.stat                                    409 ms (3960)
|                ├─ meteorNpm.isPortable..........................744 ms (33)
|                │  └─ meteorNpm.isPortable.......................720 ms (529)
|                │     └─ meteorNpm.isPortable....................672 ms (138)
|                │        └─ meteorNpm.isPortable.................628 ms (175)
|                │           └─ meteorNpm.isPortable..............579 ms (87)
|                │              └─ meteorNpm.isPortable...........555 ms (83)
|                │                 └─ meteorNpm.isPortable........496 ms (305)
|                │                    └─ meteorNpm.isPortable.....392 ms (364)
|                │                       └─ meteorNpm.isPortable  244 ms (941)
|                ├─ Builder#copyNodeModulesDirectory...........42,982 ms (33)
|                │  ├─ Builder#_ensureDirectory.................2,376 ms (6825)
|                │  │  ├─ files.stat                            1,451 ms (20577)
|                │  │  ├─ files.mkdir                             565 ms (6859)
|                │  │  └─ other Builder#_ensureDirectory          360 ms
|                │  ├─ files.writeFile                         10,726 ms (62907)
|                │  ├─ safeWatcher.watch........................6,089 ms (300820)
|                │  │  ├─ files.watchFile                       3,155 ms (300820)
|                │  │  ├─ files.stat                            1,248 ms (48325)
|                │  │  └─ other safeWatcher.watch               1,686 ms
|                │  ├─ optimistic lstat.........................2,701 ms (52413)
|                │  │  ├─ files.lstat                           2,595 ms (52413)
|                │  │  └─ other optimistic lstat                  106 ms
|                │  ├─ shouldWatch                                291 ms (49721)
|                │  ├─ files.stat                                 241 ms (47210)
|                │  ├─ optimistic hashOrNull....................8,533 ms (46952)
|                │  │  ├─ safeWatcher.watch.......................530 ms (62316)
|                │  │  │  ├─ files.watchFile                      326 ms (62316)
|                │  │  │  └─ other safeWatcher.watch              204 ms
|                │  │  ├─ optimistic readFile...................6,558 ms (46952)
|                │  │  │  ├─ files.readFile                     6,433 ms (46952)
|                │  │  │  └─ other optimistic readFile            124 ms
|                │  │  ├─ sha1                                    722 ms (46952)
|                │  │  └─ other optimistic hashOrNull             723 ms
|                │  ├─ optimistic readFile......................2,623 ms (46449)
|                │  │  └─ files.readFile                        2,526 ms (46449)
|                │  ├─ optimistic readdir.......................1,080 ms (5664)
|                │  │  └─ files.readdir                         1,068 ms (5664)
|                │  └─ other Builder#copyNodeModulesDirectory   8,289 ms
|                ├─ safeWatcher.watch.............................519 ms (6683)
|                │  └─ files.stat                                 373 ms (3920)
|                └─ other JsImage#write                           190 ms
|
| Top leaves:
| other Target#minifyJs..................................150,562 ms (3)
| files.readFile..........................................14,266 ms (148497)
| files.writeFile.........................................13,458 ms (79466)
| files.stat..............................................10,822 ms (208576)
| other Builder#copyNodeModulesDirectory...................9,817 ms (45)
| files.watchFile..........................................5,381 ms (553102)
| CssTools.minifyCss.......................................3,714 ms (12)
| files.lstat..............................................3,331 ms (86258)
| other safeWatcher.watch..................................2,631 ms (463219)
| Babel.compile............................................1,997 ms (2434)
| other ImportScanner#resolve..............................1,545 ms (20867)
| other ImportScanner#scanImports for the app..............1,479 ms (4)
| files.readdir............................................1,383 ms (7514)
| sha1.....................................................1,238 ms (84344)
| other compileUnibuild (the app)............................992 ms (4)
| other optimistic hashOrNull................................953 ms (65841)
| files.mkdir................................................719 ms (8881)
| other ImportScanner#scanImports for minifyStdJS............563 ms (1)
| other PackageSource#_findSources for os....................530 ms (1)
| other minifyCssFiles.......................................517 ms (12)
| other Target#_emitResources................................457 ms (5)
| other Builder#_ensureDirectory.............................430 ms (7985)
| files.readdirWithTypes.....................................406 ms (17014)
| other optimistic readFile..................................315 ms (136985)
| other ImportScanner#realPath...............................303 ms (7827)
| other PackageSourceBatch#_linkJS...........................265 ms (254)
| other PackageSourceBatch.computeJsOutputFilesMap...........254 ms (5)
| other JsImage#write........................................194 ms (2)
| require("./security.js")...................................187 ms (4)
| ImportScanner#getAbsModuleId...............................170 ms (16588)
| other ImportScanner#readFile...............................165 ms (4650)
| shouldWatch................................................152 ms (25142)
| other optimistic readJsonOrNull............................144 ms (3802)
| other optimistic lstat.....................................131 ms (65546)
| sha512.....................................................126 ms (8280)
| other meteorNpm.isPortable.................................126 ms (1714)
| other ClientTarget#write...................................117 ms (3)
| other bundler writeFile....................................112 ms (4010)
|
| (#1) Total: 246,059 ms (meteor build)

Original

| (#1) Profiling: meteor build
Warning: Nested Profile.run at ProjectContext prepareProjectForBuild

Changes to your project's package version selections:

crapthings:minifier-js           removed from your project
crapthings:standard-minifier-js  removed from your project
minifier-js                      added, version 2.6.0
standard-minifier-js             added, version 2.6.0

Browserslist: caniuse-lite is outdated. Please run:
npx browserslist@latest --update-db

Why you should do it regularly:
https://github.com/browserslist/browserslist#browsers-data-updating
|                                            -
| files.stat                                                        0 ms (3)
| files.readFile                                                    0 ms (3)
| require("meteor/socket-stream-client")                            1 ms (1)
| Npm.require("faye-websocket")                                    22 ms (1)
| Npm.require("permessage-deflate")                                 4 ms (1)
| meteor build................................................190,031 ms (1)
| ├─ ProjectContext prepareProjectForBuild......................5,558 ms (1)
| │  ├─ _resolveConstraints.....................................3,766 ms (1)
| │  │  ├─ bundler.readJsImage....................................232 ms (1)
| │  │  │  └─ meteorNpm.rebuildIfNonPortable......................205 ms (16)
| │  │  │     └─ meteorNpm.isPortable                             158 ms (234)
| │  │  ├─ JsImage#load...........................................773 ms (1)
| │  │  │  ├─ runJavaScript packages/dynamic-import.js............180 ms (1)
| │  │  │  │  └─ require("/node_modules/meteor/dynamic-import/server.js").179 ms (1)
| │  │  │  │     └─ require("./security.js")                      177 ms (1)
| │  │  │  └─ runJavaScript packages/npm-mongo.js.................195 ms (1)
| │  │  │     └─ Npm.require("mongodb")                           194 ms (1)
| │  │  └─ Select Package Versions..............................2,751 ms (1)
| │  │     ├─ Input#loadFromCatalog.............................1,503 ms (1)
| │  │     │  ├─ sqlite query                                     298 ms (234)
| │  │     │  └─ other Input#loadFromCatalog                    1,205 ms
| │  │     ├─ new CS.Solver.......................................113 ms (1)
| │  │     │  └─ Solver#analyze                                   113 ms (1)
| │  │     └─ Solver#getAnswer..................................1,090 ms (1)
| │  │        ├─ generate package variables                       106 ms (1)
| │  │        ├─ generate constraints                             580 ms (1)
| │  │        └─ minimize conflicts                               105 ms (1)
| │  └─ _buildLocalPackages.....................................1,675 ms (1)
| │     ├─ _ensurePackageLoaded(accounts-base)....................526 ms (1)
| │     │  └─ _ensurePackageLoaded(ecmascript)....................293 ms (1)
| │     │     ├─ IsopackCache Load local isopack..................152 ms (1)
| │     │     │  └─ Isopack#initFromPath..........................151 ms (1)
| │     │     │     └─ bundler.readJsImage........................149 ms (1)
| │     │     │        └─ meteorNpm.rebuildIfNonPortable..........146 ms (8)
| │     │     │           └─ meteorNpm.isPortable                 113 ms (187)
| │     │     └─ _ensurePackageLoaded(babel-compiler)             114 ms (1)
| │     ├─ _ensurePackageLoaded(coagmano:stylus)..................205 ms (1)
| │     │  └─ IsopackCache Load local isopack.....................205 ms (1)
| │     │     └─ Isopack#initFromPath.............................205 ms (1)
| │     │        └─ bundler.readJsImage...........................204 ms (1)
| │     │           └─ meteorNpm.rebuildIfNonPortable.............197 ms (10)
| │     │              └─ meteorNpm.isPortable                    166 ms (286)
| │     ├─ _ensurePackageLoaded(standard-minifier-css)............198 ms (1)
| │     │  └─ IsopackCache Load local isopack.....................198 ms (1)
| │     │     └─ Isopack#initFromPath.............................197 ms (1)
| │     │        └─ bundler.readJsImage...........................196 ms (1)
| │     │           └─ meteorNpm.rebuildIfNonPortable.............189 ms (12)
| │     │              └─ meteorNpm.isPortable                    154 ms (311)
| │     ├─ _ensurePackageLoaded(standard-minifier-js).............139 ms (1)
| │     │  └─ IsopackCache Load local isopack.....................139 ms (1)
| │     │     └─ Isopack#initFromPath.............................139 ms (1)
| │     │        └─ bundler.readJsImage...........................137 ms (1)
| │     │           └─ meteorNpm.rebuildIfNonPortable             131 ms (11)
| │     ├─ _ensurePackageLoaded(static-html)......................117 ms (1)
| │     │  └─ IsopackCache Load local isopack.....................117 ms (1)
| │     │     └─ Isopack#initFromPath.............................116 ms (1)
| │     │        └─ bundler.readJsImage...........................115 ms (1)
| │     │           └─ meteorNpm.rebuildIfNonPortable             105 ms (9)
| │     └─ _ensurePackageLoaded(typescript).......................126 ms (1)
| │        └─ IsopackCache Load local isopack.....................126 ms (1)
| │           └─ Isopack#initFromPath.............................126 ms (1)
| │              └─ bundler.readJsImage...........................124 ms (1)
| │                 └─ meteorNpm.rebuildIfNonPortable.............121 ms (8)
| │                    └─ meteorNpm.isPortable                    101 ms (187)
| └─ bundler.bundle...........................................184,402 ms (1)
|    ├─ compiler.compile(the app)...............................8,292 ms (1)
|    │  └─ compileUnibuild (the app)............................8,291 ms (4)
|    │     ├─ Isopack#ensurePluginsInitialized..................1,917 ms (64)
|    │     │  └─ JsImage#load...................................1,913 ms (7)
|    │     │     ├─ runJavaScript packages/ecmascript-runtime.js..204 ms (6)
|    │     │     │  └─ require("./node_modules/meteor/ecmascript-runtime/runtime.js").203 ms (1)
|    │     │     │     └─ require("meteor-ecmascript-runtime")    203 ms (1)
|    │     │     ├─ runJavaScript packages/caching-compiler.js....130 ms (2)
|    │     │     │  └─ require("./node_modules/meteor/caching-compiler/caching-compiler.js") 107 ms (1)
|    │     │     ├─ runJavaScript packages/react-fast-refresh.js..145 ms (3)
|    │     │     │  └─ require("/node_modules/meteor/react-fast-refresh/server.js") 145 ms (3)
|    │     │     ├─ runJavaScript packages/minifier-css.js........255 ms (1)
|    │     │     │  └─ require("/node_modules/meteor/minifier-css/minifier.js").252 ms (1)
|    │     │     │     └─ require("/node_modules/meteor/minifier-css/node_modules/cssnano/dist/index.js") 200 ms (1)
|    │     │     ├─ runJavaScript packages/http.js................193 ms (1)
|    │     │     │  └─ require("/node_modules/meteor/http/httpcall_server.js").193 ms (1)
|    │     │     │     └─ require("request")                      192 ms (1)
|    │     │     └─ runJavaScript packages/compileStylusBatch_plugin.js.437 ms (1)
|    │     │        └─ require("/node_modules/meteor/compileStylusBatch/plugin/compile-stylus.js").434 ms (1)
|    │     │           ├─ Npm.require("stylus")                   229 ms (1)
|    │     │           └─ Npm.require("autoprefixer-stylus")      194 ms (1)
|    │     ├─ PackageSource#_findSources for os.................2,560 ms (1)
|    │     │  ├─ _realpath........................................171 ms (3941)
|    │     │  │  └─ files.lstat                                   131 ms (3941)
|    │     │  ├─ shouldWatch                                      131 ms (3803)
|    │     │  ├─ files.readdirWithTypes                           622 ms (7870)
|    │     │  ├─ optimistic readJsonOrNull........................988 ms (3802)
|    │     │  │  ├─ safeWatcher.watch                             217 ms (6874)
|    │     │  │  ├─ optimistic readFile...........................630 ms (3802)
|    │     │  │  │  └─ files.readFile                             621 ms (3802)
|    │     │  │  └─ other optimistic readJsonOrNull               140 ms
|    │     │  └─ other PackageSource#_findSources for os          547 ms
|    │     ├─ safeWatcher.watch...................................191 ms (13755)
|    │     │  └─ files.watchFile                                  114 ms (13755)
|    │     ├─ optimistic readFile...............................1,609 ms (6723)
|    │     │  └─ files.readFile                                 1,592 ms (6723)
|    │     ├─ optimistic hashOrNull...............................609 ms (6724)
|    │     │  ├─ optimistic readFile..............................354 ms (6724)
|    │     │  │  └─ files.readFile                                340 ms (6724)
|    │     │  └─ sha1                                             143 ms (6724)
|    │     ├─ PackageSource#_findSources for web.browser          339 ms (1)
|    │     └─ other compileUnibuild (the app)                     965 ms
|    ├─ bundler.bundle..makeClientTarget......................119,041 ms (3)
|    │  └─ Target#make........................................119,040 ms (3)
|    │     ├─ Target#_runCompilerPlugins........................1,429 ms (3)
|    │     │  └─ plugin coagmano:stylus                         1,174 ms (3)
|    │     ├─ Target#_emitResources............................24,969 ms (3)
|    │     │  ├─ PackageSourceBatch.computeJsOutputFilesMap....22,841 ms (3)
|    │     │  │  ├─ ImportScanner#realPath........................571 ms (7827)
|    │     │  │  │  ├─ safeWatcher.watch                          181 ms (7524)
|    │     │  │  │  └─ other ImportScanner#realPath               289 ms
|    │     │  │  ├─ ImportScanner#scanImports for ecmascript-runtime-client.619 ms (3)
|    │     │  │  │  ├─ ImportScanner#findImportedModuleIdentifiers 162 ms (683)
|    │     │  │  │  ├─ ImportScanner#resolve......................255 ms (2385)
|    │     │  │  │  │  └─ safeWatcher.watch                       108 ms (1141)
|    │     │  │  │  └─ ImportScanner#readFile                     137 ms (678)
|    │     │  │  ├─ ImportScanner#scanImports for ddp-server-picker.899 ms (3)
|    │     │  │  │  ├─ Npm.require("meteor-babel")                266 ms (1)
|    │     │  │  │  └─ other ImportScanner#scanImports for ddp-server-picker 609 ms
|    │     │  │  ├─ ImportScanner#scanImports for minimongo.......159 ms (3)
|    │     │  │  │  └─ ImportScanner#findImportedModuleIdentifiers 119 ms (24)
|    │     │  │  ├─ ImportScanner#scanImports for ddp-client      130 ms (3)
|    │     │  │  ├─ ImportScanner#scanImports for jquery..........148 ms (3)
|    │     │  │  │  └─ ImportScanner#findImportedModuleIdentifiers 145 ms (6)
|    │     │  │  ├─ ImportScanner#scanImports for url             157 ms (3)
|    │     │  │  ├─ ImportScanner#scanImports for the app......18,827 ms (3)
|    │     │  │  │  ├─ Babel.compile                            1,605 ms (1905)
|    │     │  │  │  ├─ ImportScanner#findImportedModuleIdentifiers 5,361 ms (6564)
|    │     │  │  │  ├─ ImportScanner#resolve....................6,443 ms (19880)
|    │     │  │  │  │  ├─ files.stat                            2,266 ms (13531)
|    │     │  │  │  │  ├─ safeWatcher.watch.....................2,738 ms (24130)
|    │     │  │  │  │  │  ├─ files.stat                         2,131 ms (12864)
|    │     │  │  │  │  │  ├─ files.watchFile                      369 ms (24130)
|    │     │  │  │  │  │  └─ other safeWatcher.watch              238 ms
|    │     │  │  │  │  └─ other ImportScanner#resolve           1,357 ms
|    │     │  │  │  ├─ ImportScanner#realPath                     397 ms (4839)
|    │     │  │  │  ├─ ImportScanner#readFile.....................968 ms (4650)
|    │     │  │  │  │  ├─ optimistic readFile.....................544 ms (1992)
|    │     │  │  │  │  │  └─ files.readFile                       536 ms (1992)
|    │     │  │  │  │  ├─ optimistic hashOrNull...................190 ms (1992)
|    │     │  │  │  │  │  └─ optimistic readFile..................112 ms (1992)
|    │     │  │  │  │  │     └─ files.readFile                    107 ms (1992)
|    │     │  │  │  │  └─ other ImportScanner#readFile            178 ms
|    │     │  │  │  ├─ DefaultHandlers.js.........................997 ms (4623)
|    │     │  │  │  │  └─ reifyCompileWithCache...................949 ms (4362)
|    │     │  │  │  │     └─ files.readFile                       895 ms (2997)
|    │     │  │  │  ├─ Npm.require("meteor-babel")                226 ms (1)
|    │     │  │  │  ├─ minifyCssFiles...........................1,363 ms (9)
|    │     │  │  │  │  ├─ CssTools.minifyCss                    1,195 ms (9)
|    │     │  │  │  │  └─ other minifyCssFiles                    139 ms
|    │     │  │  │  └─ other ImportScanner#scanImports for the app 1,335 ms
|    │     │  │  └─ other PackageSourceBatch.computeJsOutputFilesMap 229 ms
|    │     │  ├─ PackageSourceBatch#getResources................1,419 ms (237)
|    │     │  │  └─ PackageSourceBatch#_linkJS..................1,412 ms (237)
|    │     │  │     ├─ files.readFile                             242 ms (237)
|    │     │  │     ├─ linker.fullLink............................759 ms (3)
|    │     │  │     │  └─ linker Module#getPrelinkedFiles.........674 ms (3)
|    │     │  │     │     ├─ linker File#getPrelinkedOutput       147 ms (5265)
|    │     │  │     │     ├─ getPrelinkedFiles toStringWithSourceMap 193 ms (3)
|    │     │  │     │     └─ other linker Module#getPrelinkedFiles 333 ms
|    │     │  │     ├─ files.writeFileAtomically..................147 ms (3)
|    │     │  │     │  └─ files.writeFile                         146 ms (3)
|    │     │  │     └─ other PackageSourceBatch#_linkJS           215 ms
|    │     │  └─ other Target#_emitResources                      655 ms
|    │     ├─ Target#minifyJs..................................91,244 ms (3)
|    │     │  ├─ Npm.require("terser")                            300 ms (1)
|    │     │  ├─ Npm.require("meteor-babel")                      181 ms (1)
|    │     │  └─ other Target#minifyJs                         90,705 ms
|    │     └─ ClientTarget#minifyCss............................1,329 ms (3)
|    │        └─ minifyCssFiles.................................1,329 ms (3)
|    │           ├─ mergeCss                                      107 ms (3)
|    │           └─ CssTools.minifyCss                          1,183 ms (3)
|    ├─ bundler.bundle..makeServerTarget........................2,455 ms (1)
|    │  └─ Target#make..........................................2,454 ms (1)
|    │     └─ Target#_emitResources.............................2,397 ms (1)
|    │        ├─ PackageSourceBatch.computeJsOutputFilesMap.....2,121 ms (1)
|    │        │  ├─ ImportScanner#realPath                        133 ms (2240)
|    │        │  └─ ImportScanner#scanImports for the app.......1,337 ms (1)
|    │        │     ├─ Babel.compile                              165 ms (219)
|    │        │     ├─ ImportScanner#findImportedModuleIdentifiers 383 ms (228)
|    │        │     ├─ ImportScanner#resolve......................655 ms (987)
|    │        │     │  ├─ files.stat                              221 ms (1310)
|    │        │     │  └─ safeWatcher.watch.......................329 ms (2328)
|    │        │     │     └─ files.stat                           277 ms (1083)
|    │        │     └─ other ImportScanner#scanImports for the app 103 ms
|    │        └─ PackageSourceBatch#getResources..................263 ms (90)
|    │           └─ PackageSourceBatch#_linkJS....................261 ms (90)
|    │              └─ linker.fullLink............................158 ms (1)
|    │                 └─ linker Module#getPrelinkedFiles         154 ms (1)
|    └─ bundler writeSiteArchive...............................54,581 ms (1)
|       ├─ bundler writeTargetToPath...........................54,399 ms (4)
|       │  ├─ ClientTarget#write................................1,255 ms (3)
|       │  │  ├─ files.stat                                       113 ms (2406)
|       │  │  ├─ bundler writeFile................................915 ms (4010)
|       │  │  │  ├─ Builder#write.................................803 ms (4010)
|       │  │  │  │  └─ files.writeFile                            707 ms (4008)
|       │  │  │  └─ other bundler writeFile                       112 ms
|       │  │  └─ other ClientTarget#write                         132 ms
|       │  └─ ServerTarget#write...............................53,138 ms (1)
|       │     └─ JsImage#write.................................53,112 ms (1)
|       │        ├─ files.stat                                    395 ms (3960)
|       │        ├─ meteorNpm.isPortable..........................702 ms (33)
|       │        │  └─ meteorNpm.isPortable.......................674 ms (529)
|       │        │     └─ meteorNpm.isPortable....................630 ms (138)
|       │        │        └─ meteorNpm.isPortable.................584 ms (175)
|       │        │           └─ meteorNpm.isPortable..............546 ms (87)
|       │        │              └─ meteorNpm.isPortable...........514 ms (83)
|       │        │                 └─ meteorNpm.isPortable........453 ms (305)
|       │        │                    └─ meteorNpm.isPortable.....358 ms (364)
|       │        │                       └─ meteorNpm.isPortable  207 ms (941)
|       │        ├─ Builder#copyNodeModulesDirectory...........51,130 ms (33)
|       │        │  ├─ Builder#_ensureDirectory.................2,724 ms (6825)
|       │        │  │  ├─ files.stat                            1,632 ms (20577)
|       │        │  │  ├─ files.mkdir                             660 ms (6859)
|       │        │  │  └─ other Builder#_ensureDirectory          432 ms
|       │        │  ├─ safeWatcher.watch........................8,371 ms (367987)
|       │        │  │  ├─ files.watchFile                       4,343 ms (367987)
|       │        │  │  ├─ files.stat                            1,694 ms (60764)
|       │        │  │  └─ other safeWatcher.watch               2,334 ms
|       │        │  ├─ optimistic lstat.........................2,811 ms (66590)
|       │        │  │  ├─ files.lstat                           2,682 ms (66590)
|       │        │  │  └─ other optimistic lstat                  129 ms
|       │        │  ├─ shouldWatch                                431 ms (64797)
|       │        │  ├─ files.stat                                 305 ms (58717)
|       │        │  ├─ optimistic hashOrNull....................9,424 ms (58644)
|       │        │  │  ├─ safeWatcher.watch.......................769 ms (74749)
|       │        │  │  │  ├─ files.watchFile                      499 ms (74749)
|       │        │  │  │  └─ other safeWatcher.watch              270 ms
|       │        │  │  ├─ optimistic readFile...................6,628 ms (58644)
|       │        │  │  │  ├─ files.readFile                     6,471 ms (58644)
|       │        │  │  │  └─ other optimistic readFile            157 ms
|       │        │  │  ├─ sha1                                  1,012 ms (58644)
|       │        │  │  └─ other optimistic hashOrNull           1,015 ms
|       │        │  ├─ optimistic readFile......................3,513 ms (58157)
|       │        │  │  ├─ files.readFile                        3,379 ms (58157)
|       │        │  │  └─ other optimistic readFile               134 ms
|       │        │  ├─ files.writeFile                         12,235 ms (62907)
|       │        │  ├─ optimistic readdir.........................890 ms (6790)
|       │        │  │  └─ files.readdir                           875 ms (6790)
|       │        │  └─ other Builder#copyNodeModulesDirectory  10,389 ms
|       │        ├─ safeWatcher.watch.............................589 ms (6683)
|       │        │  ├─ files.watchFile                            104 ms (6683)
|       │        │  └─ files.stat                                 432 ms (3920)
|       │        └─ other JsImage#write                           188 ms
|       └─ other bundler writeSiteArchive                         178 ms
|
| Top leaves:
| other Target#minifyJs...................................90,705 ms (3)
| files.readFile..........................................15,378 ms (148023)
| files.writeFile.........................................13,163 ms (67100)
| files.stat..............................................10,900 ms (205146)
| other Builder#copyNodeModulesDirectory..................10,389 ms (33)
| files.watchFile..........................................6,134 ms (554055)
| files.lstat..............................................3,104 ms (87380)
| other safeWatcher.watch..................................2,966 ms (489632)
| CssTools.minifyCss.......................................2,378 ms (12)
| Babel.compile............................................2,040 ms (2430)
| other ImportScanner#resolve..............................1,522 ms (23252)
| other ImportScanner#scanImports for the app..............1,438 ms (4)
| sha1.....................................................1,317 ms (83893)
| other Input#loadFromCatalog..............................1,205 ms (1)
| other optimistic hashOrNull..............................1,115 ms (67360)
| files.readdir..............................................970 ms (7488)
| other compileUnibuild (the app)............................965 ms (4)
| files.mkdir................................................740 ms (7671)
| files.readdirWithTypes.....................................672 ms (16990)
| other Target#_emitResources................................667 ms (4)
| other ImportScanner#scanImports for ddp-server-picker......609 ms (3)
| generate constraints.......................................580 ms (1)
| other PackageSource#_findSources for os....................547 ms (1)
| other Builder#_ensureDirectory.............................432 ms (6825)
| other optimistic readFile..................................342 ms (138034)
| other linker Module#getPrelinkedFiles......................333 ms (3)
| sqlite query...............................................323 ms (339)
| other ImportScanner#realPath...............................289 ms (7827)
| other PackageSourceBatch.computeJsOutputFilesMap...........284 ms (4)
| getPrelinkedFiles toStringWithSourceMap....................281 ms (4)
| other PackageSourceBatch#_linkJS...........................256 ms (327)
| require("./security.js")...................................227 ms (4)
| linker File#getPrelinkedOutput.............................208 ms (5492)
| other JsImage#write........................................188 ms (1)
| files.read.................................................180 ms (1231)
| other bundler writeSiteArchive.............................178 ms (1)
| other minifyCssFiles.......................................178 ms (12)
| other ImportScanner#readFile...............................178 ms (4650)
| ImportScanner#getAbsModuleId...............................145 ms (16536)
| other optimistic readJsonOrNull............................140 ms (3802)
| other ClientTarget#write...................................132 ms (3)
| other optimistic lstat.....................................129 ms (66590)
| sha512.....................................................122 ms (8280)
| other meteorNpm.isPortable.................................114 ms (1714)
| other bundler writeFile....................................112 ms (4010)
| generate package variables.................................106 ms (1)
| minimize conflicts.........................................105 ms (1)
| shouldWatch................................................100 ms (12428)
|
| (#1) Total: 190,058 ms (meteor build)
|
filipenevola commented 3 years ago

Hi @linegel and @crapthings we are looking for alternatives like this.

@renanccastro could help in this work.

The first step would be to define the scope for a PoC and the tools that we want to try first.