-
Notifications
You must be signed in to change notification settings - Fork 522
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Examples angular does not work on legacy browsers #1869
Comments
Its expected that that examples won't work when run from within the nested repository on any given commit; especially on the current master where we're churning on breaking changes such as the change to If you checkout the repo at a release then you'll have better luck with the examples. The latest working stand-alone examples/angular is at the 7ac0ada commit (https://github.com/bazelbuild/rules_nodejs/tree/7ac0ada272c9a234c1eed6c8ba9d1e3f2e1ac4b3/examples/angular). This is the The reason they don't work on an given commit from within the nested workspace is that examples are kept up to date with the root workspace but their WORKSPACE files and package.json files still reference the last release (which is currently 1.6). When running stand-alone there will be version skew between the examples code (which is mean to work with the rules in the root workspace) and the last release of rules_nodejs which they pull in. We test them in the repo with a bazel_integration_test rule that modifies their WORKSPACES files and package.json references with generated packages that are build in the root WORKSPACE. For example, you can run examples/angular tests on master with At the very least I think we should document this in the main README since users will naturally gravitate towards checking out the latest and looking at the examples. @alexeagle thoughts? |
Windows support is general problem in the Bazel and in the Bazel rules ecosystem and not something unique to rules_nodejs. We're one of the few rule sets that has CI against Windows but not everything works and a lot of that is beyond our control. We have quite a few |
With ts_library es5 & es2015 outputs, you may have better luck with the architect() rules used in |
Thank you very much for your answer. I will check if I can use the architect rule with our small monorepo. |
@gregmagolan Maybe an additional comment; The current implementation for es5 in the angular example cannot work, so I'm not sure what kind of purpose it serves? |
As an update;
|
I have made some progress with creating a initializer script, which loads either the es5 or the es2015 depending on circumstances. |
An "initializer script" is probably the wrong thing, we generally key the modern/legacy JS based on the availability of I'm still not sure if there is something we need to do here. Is there a bug in rules_nodejs or the example? |
The docs state that the example is now published to https://bazel.angular.io/example/, which I appreciate. However it does not seem to work yet? At least the output files in https://bazel.angular.io/example/ do not correspond to the output files when I build src:prodapp locally. The following problems persist and I would argue that this is a bug in the example:
An additional question; Why do you not fingerprint the index.js files (https://github.com/bazelbuild/rules_nodejs/blob/master/examples/angular/src/example/index.prod.html#L20-L21) with a simple genrule? |
Thanks for pointing out problems with legacy browsers and showing your workaround. The Fingerprinting sounds great, I think our example is just not comprehensive and shows the things we thought of. Would love to add that if you have time. |
I finally managed to invest a bit of time into WSL2, which should help me with running the examples. |
I don't really care what's in the example, so long as it's easy for us to maintain and represents some kind of consensus from Angular developers about what's a good practice. If you want to add something that Angular CLI doesn't do, that's great because it shows how Bazel lets you customize the toolchain. |
This issue has been automatically marked as stale because it has not had any activity for 60 days. It will be closed if no further activity occurs in two weeks. Collaborators can add a "cleanup" or "need: discussion" label to keep it open indefinitely. Thanks for your contributions to rules_nodejs! |
This issue was automatically closed because it went two weeks without a reply since it was labeled "Can Close?" |
ng new is not working but generating below error |
🐞 bug report
Affected Rule
https://github.com/bazelbuild/rules_nodejs/tree/master/examples/angular
yarn serve-prod
Is this a regression?
Partially
Description
The Angular example in https://github.com/bazelbuild/rules_nodejs/tree/master/examples/angular does not work at all.
Problems:
load("@npm//@bazel/typescript:index.bzl", "ts_library")
should probably beload("@npm_bazel_typescript//:index.bzl", "ts_library")
and others)require(
imports and system.js not providingrequire
importsSCRIPT5022: SCRIPT5022: Syntax error
yarn serve-prod
(orbazel run //src:prodserver
) can result in an errorNo 'bazel-out' folder found in path 'c:/users/lukas/_bazel~1/zhhytyhl/execroot/exampl~1/bazel-~1/x64_wi~1/bin/src/prodse~2.run'!
(which I can work around by changing directory to the folder of prodserver.bat and starting it from there). This happens due to looking for/bazel-root/
in resolveRoot in the linker (https://github.com/bazelbuild/rules_nodejs/blob/master/internal/linker/link_node_modules.ts#L124) and process.cwd() only provides the shortened path on unclear circumstances. As far as I can tell, there is no easy way to convert the shortened path in nodejs.🔬 Minimal Reproduction
https://github.com/bazelbuild/rules_nodejs/tree/master/examples/angular
yarn serve-prod
Anything else relevant?
First; I'm very grateful for the NodeJS rules for Bazel.
However I can't help but feel a bit disheartened, when the official example does not work. Especially with the deprecation of
ng_module
.Maybe for comparison; Our current implementation (which also does not work due to the above mentioned problems): https://github.com/sbb-design-systems/sbb-angular/blob/master/src/showcase/BUILD.bazel
The text was updated successfully, but these errors were encountered: