Skip to content
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

Update imports to include file extensions #299

Merged
merged 1 commit into from
Dec 13, 2023

Conversation

paul-sachs
Copy link
Collaborator

@paul-sachs paul-sachs commented Dec 13, 2023

Fixes #298

Ideally this would be caught on compile, but we need to address that in #186.

@paul-sachs paul-sachs merged commit 5d0015e into main Dec 13, 2023
7 checks passed
@paul-sachs paul-sachs deleted the psachs/module-imports-node16 branch December 13, 2023 14:09
@paul-sachs paul-sachs mentioned this pull request Dec 14, 2023
paul-sachs added a commit that referenced this pull request Dec 14, 2023
## What's Changed
* Update imports to include file extensions by @paul-sachs in
#299 and
#307
* Added support for cjs output by @paul-sachs in
#303
* Loosen peer dependency requirement by @paul-sachs in
#306

## CJS output

By default,
[protoc-gen-connect-query](https://www.npmjs.com/package/@connectrpc/protoc-gen-connect-query)
(and all other plugins based on
[@bufbuild/protoplugin](https://www.npmjs.com/package/@bufbuild/protoplugin))
generate ECMAScript `import` and `export` statements. For use cases
where CommonJS is difficult to avoid, a new plugin option has been added
named `js_import_style` which can be used to generate CommonJS
`require()` calls.

Here is an example
[buf.gen.yaml](https://buf.build/docs/configuration/v1/buf-gen-yaml):

```yaml
version: v1
plugins:
  # You'll need @bufbuild/protoc-gen-es v1.6.0 or later
  - plugin: es
    out: src/gen
    opt: js_import_style=legacy_commonjs
  - plugin: protoc-gen-connect-query
    out: src/gen
    opt: js_import_style=legacy_commonjs
```

To view the full PR, see **Added support for cjs output** by @paul-sachs
in #303

**Full Changelog**:
v1.0.0...v1.1.0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Issue with @connectrpc/connect-query: Module not found: Error: Can't resolve './use-transport'
2 participants