Skip to content

vpanta/ts_lib_module_root_bug

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ca0aef8 · Apr 2, 2021

History

6 Commits
Apr 2, 2021
Mar 31, 2021
Apr 2, 2021
Mar 31, 2021
Mar 31, 2021
Mar 31, 2021
Apr 2, 2021
Mar 31, 2021
Mar 31, 2021
Mar 31, 2021
Mar 31, 2021
Mar 31, 2021

Repository files navigation

Example of ts_library module output failing to link

To see the build failures when using the webpack_bundle rule, do the following:

  1. Update the MODULE value in module_type.bzl to one of none or commonjs.
  2. Execute bazel build //:bundle

What's going on?

As far as I can tell, when using commonjs or none, the generated output should be resolvable by Node itself. The tsc-generated JavaScript in these cases requires based purely on the original import declaration. However, the LinkablePackageInfo does not take into account module_root, so these import attempts fail to resolve (e.g. bazel has made JS module foo available under .../package_foo/src/foo, but mapped package_foo to .../package_foo).

Interestingly, it works fine under module-type umd, as tsc rewrites the import to account for this (e.g. TS referencing foo/foo becomes JS referencing foo/src/foo).

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published