-
Notifications
You must be signed in to change notification settings - Fork 33
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
Missing exports: unary #64
Comments
Thanks for reporting this issue and creating a test case for it. I did some debugging and I've been able to get rid of the rollup errors by changing // test/rollup.config.js
const commonjs = require('rollup-plugin-commonjs');
const nodeRequire = require('rollup-plugin-node-resolve');
module.exports = {
plugins: [
nodeRequire(),
commonjs({
namedExports: {
'@improbable-eng/grpc-web': [
'unary',
'Code',
],
}
}),
],
}; This doesn't make your test pass, but I think it's a step in the right direction. In the test, I get an error:
I've run out of time to debug today, maybe you can figure out what's going wrong in the test? If not, I can take another look tomorrow. |
Thanks I will take another look today. |
Made some progress: with the change you suggested in #64 (comment), the generated var grpcWebClient = createCommonjsModule(function (module, exports) {
// what looks like the content of
// @improbable-eng/grpc-web/dist/grpc-web-client.js
}
// ...
unwrapExports(grpcWebClient);
var grpcWebClient_1 = grpcWebClient.unary;
var grpcWebClient_2 = grpcWebClient.Code;
// ...
PizzaServiceClient.prototype.orderPizza = function orderPizza(requestMessage, metadata, callback) {
if (arguments.length === 2) {
callback = arguments[1];
}
var client = grpcWebClient_1(PizzaService.OrderPizza, {
request: requestMessage,
host: this.serviceHost,
// ... And this is what So the generated bundle should actually contain: unwrapExports(grpcWebClient);
var grpcWebClient_1 = grpcWebClient.grpc.unary;
var grpcWebClient_2 = grpcWebClient.grpc.Code; (also Looking at the the commit history and CI logs, it seems the warning about unresolved imports originated in PR #13 |
Hmm, my JS-fu is not quite there, but I think this might be the cause: Rollup.js is complaining about a named import/export not resolving. But pizza_service_pb_serivce.mjs is using namespace import: // pizza_service_pb_serivce.mjs
import * as test_proto_pizza_service_pb from "rules_typescript_proto/test/proto/pizza_service_pb";
import * as grpc from "@improbable-eng/grpc-web"; whereas: // pizza_service_pb_serivce.d.ts
import * as test_proto_pizza_service_pb from "../../test/proto/pizza_service_pb";
import {grpc} from "@improbable-eng/grpc-web"; // pizza_service_pb_serivce.js
var test_proto_pizza_service_pb = require("rules_typescript_proto/test/proto/pizza_service_pb");
var grpc = require("@improbable-eng/grpc-web").grpc; both seem to be correctly "reaching into" the So I think rollup.js is correct about not being able to find |
Good find! You're correct,
Overall PR looks good, once we get the tests fixed it should be good to go. |
Noted, thanks! I will probably need to get back to this next week. |
Description
When building rollup bundles with
@improbable-eng/grpc-web
, a warning about "Missing exports" is thrown.Errors seen
Minimal Reproduction
Your Environment
What operating system are you using?
macOS 10.15.2
What version of bazel are you using?
Build label: 2.0.0
Build target: bazel-out/darwin-opt/bin/src/main/java/com/google/devtools/build/lib/bazel/BazelServer_deploy.jar
Build time: Thu Dec 19 12:33:30 2019 (1576758810)
Build timestamp: 1576758810
Build timestamp as int: 1576758810
What version of the library are you using?
git commit e3a6de3
Any other comments?
I noticed that this warning is also present in the most recent CI run:
https://github.com/Dig-Doug/rules_typescript_proto/runs/396864580#step:5:50
I am also aware of improbable-eng/grpc-web#369, which has a slightly different warning about
grpc
not being exported. Whereas the current issueconcerns
grpc.unary
andgrpc.Code
. So I am not sure if this is a regression or a new bug.The text was updated successfully, but these errors were encountered: