Name AMD module `foo` rather than `foo/module_root/index`

We already had logic to name it foo rather than foo/index, introduced in https://github.com/bazelbuild/rules_typescript/commit/c7b6880767eaae44d8777a7a1b137de92b8fd4d9

If the module_root is specified as a directory on the ts_library, it means that the index file is in that subdirectory of the package. We already handled this case correctly in type-checking, but at runtime the module identifiers don't match so the require('foo/module_root/index') fails.

Fixes bazelbuild/rules_nodejs#973

PiperOrigin-RevId: 262663195
2 files changed
tree: 3fc96135c0a0fa38ed97f6f7f68906893be2f029
  1. .bazelci/
  2. .github/
  3. .vscode/
  4. devserver/
  5. docs/
  6. internal/
  7. third_party/
  8. ts_auto_deps/
  9. .bazelignore
  10. .bazelrc
  11. .gitignore
  12. AUTHORS
  13. BUILD.bazel
  14. CODE_OF_CONDUCT.md
  15. CODEOWNERS
  16. CONTRIBUTING.md
  17. CONTRIBUTORS
  18. LICENSE
  19. package.bzl
  20. package.json
  21. README.md
  22. tsconfig.json
  23. WORKSPACE
  24. yarn.lock
README.md

build_bazel_rules_typescript

This repo contains a mirror of some Google-internal bits that support TypeScript development under Bazel.

It contains these utilities:

  • ts_devserver: a Go library and binary that runs a fast local web server which concatenates JavaScript on-the-fly. It requires inputs in a named module format (module ids must be contained in the file, not inferred from the file's path).
  • ts_auto_deps: a Go library and binary which generates BUILD.bazel files from TypeScript sources.
  • tsc_wrapped: a TypeScript program which wraps the TypeScript compiler, hosting it under a Bazel worker.
  • tsetse: a collection of third-party “strictness” checks which we add to the TypeScript compiler.
  • internal/common/*.bzl: some Starlark utility code for running the ts_library rule.

There are no user-facing bits in this repo. These utilities are consumed in https://github.com/bazelbuild/rules_nodejs/tree/master/packages/typescript

Please file issues for ts_library rule and other Bazel rules in that repo.