docs and generate code issue

This issue has been tracked since 2023-02-25.

Describe the bug

in docs https://connect.build/docs/web/generating-code

Output
Let's take a peek at what was generated. There are two new files:

gen/buf/connect/demo/eliza/v1/eliza_connect.ts
gen/buf/connect/demo/eliza/v1/eliza_pb.ts
The first file was generated by protoc-gen-connect-es and contains the service:

import { SayRequest, SayResponse } from "./eliza_pb.js";
import { MethodKind } from "@bufbuild/protobuf";

import { SayRequest, SayResponse } from "./eliza_pb.js";

should be

import { SayRequest, SayResponse } from "./eliza_pb";

or

import { SayRequest, SayResponse } from "./eliza_pb.ts";

Environment (please complete the following information):

  • @bufbuild/connect-web 0.7.0 / 0.8.0
  • @bufbuild/connect 0.7.0 / 0.8.0
timostamm wrote this answer on 2023-02-25

If you want to write TypeScript with ECMAScript modules that works on Node.js and other environments, you have to use a .js extension in import paths to .ts files. See this lengthy explanation.

This is also reflected in the code we generate. You can change or remote the extension in generated import paths with this option if you prefer.

More Details About Repo
Owner Name bufbuild
Repo Name connect-es
Full Name bufbuild/connect-es
Language TypeScript
Created Date 2022-02-16
Updated Date 2023-03-24
Star Count 852
Watcher Count 20
Fork Count 33
Issue Count 17

YOU MAY BE INTERESTED

Issue Title Created Date Updated Date