rules_proto_grpc icon indicating copy to clipboard operation
rules_proto_grpc copied to clipboard

The Test workspace for Typescript doesn't work

Open yungwarlock opened this issue 3 years ago • 1 comments

Issue Description

I tried the example workspace defined in the test_workspace for typescript.

The test cases work when nothing is done. But doesn't when you try to use the generated protobuf js files.

Here's my description:

import * as grpc from '@grpc/grpc-js';
import * as demo_pb from 'js_lib/js_lib_pb/demo_pb.js';
import * as demo_grpc_pb from 'js_lib/js_lib_pb/demo_grpc_pb.js';

console.log(new demo_pb.demo());

Log Output

exec ${PAGER:-/usr/bin/less} "$0" || exit 1
Executing tests from //:test_main
-----------------------------------------------------------------------------
Error: Cannot find module 'js_lib/js_lib_pb/demo_pb.js'
Require stack:
- /home/gitpod/.cache/bazel/_bazel_gitpod/50eee0b5ac8cdff0f4e9de14fb020547/sandbox/processwrapper-sandbox/837/execroot/__main__/bazel-out/k8-fastbuild/bin/test_main.sh.runfiles/__main__/main.js
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:889:15)
    at Function.Module._load (internal/modules/cjs/loader.js:745:27)
    at Module.require (internal/modules/cjs/loader.js:961:19)
    at require (internal/modules/cjs/helpers.js:92:18)
    at main.ts:2:1
    at /home/gitpod/.cache/bazel/_bazel_gitpod/50eee0b5ac8cdff0f4e9de14fb020547/sandbox/processwrapper-sandbox/837/execroot/__main__/bazel-out/k8-fastbuild/bin/test_main.sh.runfiles/__main__/main.js:22:17
    at Object.<anonymous> (/home/gitpod/.cache/bazel/_bazel_gitpod/50eee0b5ac8cdff0f4e9de14fb020547/sandbox/processwrapper-sandbox/837/execroot/__main__/bazel-out/k8-fastbuild/bin/test_main.sh.runfiles/__main__/main.js:28:3)
    at Module._compile (internal/modules/cjs/loader.js:1072:14)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1101:10)
    at Module.load (internal/modules/cjs/loader.js:937:32)

rules_proto_grpc Version

:master at 2e8be8

Bazel Version

5.1.1

OS

Linux

Link to Demo Repo

https://github.com/rules-proto-grpc/rules_proto_grpc

WORKSPACE Content

No response

BUILD Content

No response

Proto Content

No response

Any Other Content

No response

yungwarlock avatar May 01 '22 18:05 yungwarlock

I think this is the same as #155, where the issue is that prefix stripping works with js_library in rules_nodejs, but does not work when that library is then used from TypeScript.

aaliddell avatar May 03 '22 22:05 aaliddell