Questions tagged [bazel-rules-nodejs]

27 questions
22
votes
3 answers

Nest can't resolve dependencies in the RootTestModule context when I use Bazel Test

I need to run my tests in the bezel. how can I solve this mysterious problem? I have a nestjs project contains multiple apps and libs. When I run the test yarn jest --config ./jest.config.json libs/lib1, it works perfectly. However when I run with…
Hossein Mayboudi
  • 395
  • 1
  • 4
  • 12
6
votes
1 answer

Bazel: build js_library with another linked JS dependency (yarn workspaces)

I have a project that includes several JS packages and organized with Yarn workspaces: ├── WORKSPACE ├── package.json ├── workspaces │ ├── foo │ │ ├── package.json │ │ ├── BUILD.bazel │ │ ├── src │ ├── bar │ ├──…
koorosh
  • 414
  • 4
  • 7
5
votes
0 answers

How to make a Bazel TypeScript monorepo with individually deployable packages

I've been trying to get a bazel monorepo with typescript to work. I have a couple of requirements in mind. I should be able to import local packages using @myworkspace/ instead of ../../../ and so on, without needing Bazel. This is mostly so I get…
Vitor EL
  • 375
  • 2
  • 9
5
votes
1 answer

Execute typescript files passed as arguments from a bazel rule

I'm writing a bazel rule in js for a mono repo. The idea behind this is services inside the mono repo(micro services) define there api spec in a open api schema files. In our case these schemas are in ts files since spec is broken as each route and…
Susitha Ravinda Senarath
  • 1,648
  • 2
  • 27
  • 49
4
votes
1 answer

Bazel map directory located outside of `src` to `build`

I have no idea on Bazel or how it works but I have to resolve this issue that finally boiled down to bazel not copying a certain directory into build. I refactored a code so a certain key ( jwk ) is first tried to read from a directory private-keys.…
Susitha Ravinda Senarath
  • 1,648
  • 2
  • 27
  • 49
4
votes
1 answer

How to setup absolute imports with bazel/webpack?

I want to import a typescript module from one part of my repo at another part without having a bunch of "../.." in my imports to get back to the root folder of my bazel workspace. How can I setup absolute imports (relative to my workspace) for…
Wesley
  • 1,412
  • 1
  • 15
  • 23
2
votes
1 answer

Bazel fails to compile TypeScript project

I'm trying to convert multiple repos of microservices into a single monorepo. I want to use Bazel for this. Im new to Bazel and just started migrating the repos. At the moment I just want to migrate some node.js TypeScript projects. In a basic test…
2
votes
1 answer

Test coverage reports with Bazel + Typescript + Jest

I'm working on converting a Node.js library to use Bazel as the build system. So far I have managed to get my TS rules and a basic Jest test execution to work. You can my setup…
lqc
  • 7,434
  • 1
  • 25
  • 25
1
vote
1 answer

How to configure unhandled-rejections for jest in bazel

The below configuration in npmrc file suppresses the error for unhandledPromiseRejection after migration from node 14 to node 16. .npmrc node-options="--unhandled-rejections=none" But in bazel using jest_test, unsure where to configure this. Can we…
Mithun Shreevatsa
  • 3,588
  • 9
  • 50
  • 95
1
vote
0 answers

Bazel/NodeJS - nodejs_binary data referencing another rule not working as expected

We have a monorepo with several typescript code bases and want to have some shared code: The common code is: ts_project( name = "common", srcs = glob( ["**/*.ts"], exclude = ["**/*.spec.ts"], ), composite = True, …
user910046
  • 308
  • 4
  • 14
1
vote
1 answer

NextJs application build with Bazel

During a Bazel build of a NextJs project I get a error related to cjs react. Generating static pages (0/3)TypeError: Cannot read properties of null (reading 'useContext') at Object.exports.useContext…
1
vote
1 answer

Bazel clean only a subset of the cached rules

I am currently developing in a monorepo that has a pretty large workspace file. Right now, I am noting that one of my testing rules, is not getting its dependency rules re-built when I update one of my tests. Here is an example of…
Cameron
  • 2,805
  • 3
  • 31
  • 45
1
vote
3 answers

bazel rules_nodejs can't resolve modules using custom package.json location

Bazel rules_nodejs can't resolve modules using custom package.json location. Can someone help explain how to fix it? Ideally I'd like to use a single tsconfig.json in third_party/npm instead. bazel build //demo/node:bin Gives…
Stephen
  • 7,994
  • 9
  • 44
  • 73
1
vote
2 answers

Can't run Bazel nodejs_image with Puppeteer (Error: libgobject-2.0.so.0)

I am using Bazel to build Docker containers: ts_config( name = "tsconfig", src = "tsconfig.lib.json", ) ts_project( name = "lib", srcs = ["index.ts"], declaration = True, tsconfig = "tsconfig", deps = [ …
Florian Ludewig
  • 4,338
  • 11
  • 71
  • 137
1
vote
1 answer

How to fail a Bazel build on a rule failure?

I am using Bazel rules in NodeJS in my application. The aim is to simply lint a set of files and fail the build if linting fails. What I'm currently experiencing is that the build is successful despite lint errors. Here's a part of my BUILD…
Slartibartfast
  • 1,592
  • 4
  • 22
  • 33
1
2