You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Just started experimenting with the rollup_bundle and in general it works quite well. I was just wondering, is any sort of cache being utilized inbetween builds? As in if just one file is changes, does it r
ollup reanalyse everything again?
From my understanding it would currently not be utilised but not quite sure.
What it says in the rollup docs about it:
cache
Object A previously-generated bundle. Use it to speed up subsequent builds — Rollup will only reanalyse the modules that have changed.
Hmm, that's interesting. Typically a bazel action runs in isolation, just given some inputs it produces some outputs, and if any input changes, the whole action is re-run.
However with Bazel workers it is possible to keep a warm instance of some tool, and that instance could hold some state internally. There's no guarantee you get the same worker every time, there are a pool of them to handle parallel builds.
That adds quite a bit of complexity though. We try to squeeze performance in development mode, but bundlers like rollup should only be used in production mode, which isn't in the critical path of your typical development round-trip. So it's better to keep these simple.
I have a draft post about how the code-splitting ought to work, which would allow better parallelization in rollup, but that's a long way out.
I'll close this since it's working as intended that we don't do caching internally in rollup. Thanks for asking!
@alexeagle Thanks for the answer, makes sense. I think it is reasonably common to also bundle the js in development mode, but you are suggesting not bundling and just using a nodejs_binary that can then be served or straight using http_server (would be nice to have referenced on the website btw) and the browser can just resolve the es6 modules itself now? Which should have a fairly low development round trip time i suppose.
Also looking forward to see the post on code-splitting.
Under devmode there is a different highly scalable bundling strategy. If
you use `ts_web_test` or `ts_devserver` this happens automatically. It's
part of the TypeScript layering because this devmode speed comes from
assuming that all JS source files have named UMD/AMD format, so they can be
concatenated together without any module format transpilation and without
losing the module names.
See
https://github.com/alexeagle/angular-bazel-example/wiki/Running-a-devserver-under-Bazel
Is your use case just authoring in JavaScript, or is it TypeScript?
These pointers so far have been really helpful already, thanks and I can start dig more into it. Would be great to get this working for plain js, then I think our devs would be quite happy with the switch to bazel.
But to get a bit more of a high level idea: the named AMD modules, that is a conversion that happens internally in the ts devserver before concatenation? As I see in the example repo it's just es6 modules.
For devmode we grab a different output from the transitive closure of the
ts_library rules, which is not es6 - it's es5 in UMD format. See the
es5_consumer.bzl in rules_typescript.
If you are writing plain JS, why do you need bazel at all?
On Thu, May 10, 2018 at 11:49 AM Markus Padourek ***@***.***> wrote:
But these pointers so far have been really helpful already and I can start
dig more into it. Would be great to get this working for plain js, then I
think our devs would be quite happy with the switch to bazel.
But to get a bit more of a high level idea: the named AMD modules, that is
a conversion that happens internally in the ts devserver before
concatenation? As I see in the example repo it's just es6 modules.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#200 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAC5I7t6tMcLm5kME1U3CQ2N0o-qykbtks5txIumgaJpZM4T4mG1>
.
Short answer: It would be multiple js+sass projects with internal-only shared code as part of a monorepo with a few other languages and cross-language dependencies.
If you are interested in the long answer: That is what I got used to at one of my previous jobs, first we used buck to build our js/es2015+ and then please (https://please.build/). Now it just made more sense to look into bazel as it is more active in the open source space, and personally, while there are a few things I prefer about please overall I do prefer how bazel works. That aside I think using bazel for js (frontend) is imo not too different to using it for python, nodejs or any interpreted language. It is a bit of a special case but imo it can still benefit from the declarative specification, the tight and explicit dependency management, as well as making it really easy to share company internal common code between projects and making sure the right tests are being run on changes. If it was a single, isolated js project just depending on npm packages, I would not use bazel (maybe if bazel was more mature and had auto-generation for build targets).
On Fri, May 11, 2018, 2:28 AM Markus Padourek ***@***.***> wrote:
Short answer: It would be multiple js+sass projects with internal-only
shared code as part of a monorepo with a few other languages and
cross-language dependencies.
If you are interested in the long answer: That is what I got used to at
one of my previous jobs, first we used buck to build our js/es2015+ and
then please (https://please.build/). Now it just made more sense to look
into bazel as it is more active in the open source space, and personally,
while there are a few things I prefer about please overall I do prefer how
bazel works. That aside I think using bazel for js (frontend) is imo not
too different to using it for python, nodejs or any interpreted language.
It is a bit of a special case but imo it can still benefit from the
declarative specification, the tight and explicit dependency management, as
well as making it really easy to share company internal common code between
projects and making sure the right tests are being run on changes. If it
was a single, isolated js project just depending on npm packages, I would
not use bazel (maybe if bazel was more mature and had auto-generation for
build targets).
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#200 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAC5IxGP1wDfoPg7aFyaKjNh3gCN_14Pks5txVmvgaJpZM4T4mG1>
.
Activity
alexeagle commentedon May 10, 2018
Hmm, that's interesting. Typically a bazel action runs in isolation, just given some inputs it produces some outputs, and if any input changes, the whole action is re-run.
However with Bazel workers it is possible to keep a warm instance of some tool, and that instance could hold some state internally. There's no guarantee you get the same worker every time, there are a pool of them to handle parallel builds.
That adds quite a bit of complexity though. We try to squeeze performance in development mode, but bundlers like rollup should only be used in production mode, which isn't in the critical path of your typical development round-trip. So it's better to keep these simple.
I have a draft post about how the code-splitting ought to work, which would allow better parallelization in rollup, but that's a long way out.
I'll close this since it's working as intended that we don't do caching internally in rollup. Thanks for asking!
Globegitter commentedon May 10, 2018
@alexeagle Thanks for the answer, makes sense. I think it is reasonably common to also bundle the js in development mode, but you are suggesting not bundling and just using a
nodejs_binarythat can then be served or straight usinghttp_server(would be nice to have referenced on the website btw) and the browser can just resolve the es6 modules itself now? Which should have a fairly low development round trip time i suppose.Also looking forward to see the post on code-splitting.
alexeagle commentedon May 10, 2018
Globegitter commentedon May 10, 2018
Ahh that sounds very interesting I'll have a read. Our case is just Javascript / es2015+, should that be possible here also?
Globegitter commentedon May 10, 2018
These pointers so far have been really helpful already, thanks and I can start dig more into it. Would be great to get this working for plain js, then I think our devs would be quite happy with the switch to bazel.
But to get a bit more of a high level idea: the named AMD modules, that is a conversion that happens internally in the ts devserver before concatenation? As I see in the example repo it's just es6 modules.
alexeagle commentedon May 10, 2018
Globegitter commentedon May 11, 2018
Short answer: It would be multiple js+sass projects with internal-only shared code as part of a monorepo with a few other languages and cross-language dependencies.
If you are interested in the long answer: That is what I got used to at one of my previous jobs, first we used buck to build our js/es2015+ and then please (https://please.build/). Now it just made more sense to look into bazel as it is more active in the open source space, and personally, while there are a few things I prefer about please overall I do prefer how bazel works. That aside I think using bazel for js (frontend) is imo not too different to using it for python, nodejs or any interpreted language. It is a bit of a special case but imo it can still benefit from the declarative specification, the tight and explicit dependency management, as well as making it really easy to share company internal common code between projects and making sure the right tests are being run on changes. If it was a single, isolated js project just depending on npm packages, I would not use bazel (maybe if bazel was more mature and had auto-generation for build targets).
alexeagle commentedon May 11, 2018