Skip to content

Commit

Permalink
Add explicit exports for Node (#645)
Browse files Browse the repository at this point in the history
Fixes #610 

This adds explicit exports for node into the package.json for all
published packages in Protobuf-ES. In addition, it modifies the path for
the top-level import statement to use ESM instead of the proxy.

For additional context, see
connectrpc/connect-es#921
  • Loading branch information
smaye81 authored Dec 6, 2023
1 parent 2062cd7 commit 093967d
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 6 deletions.
8 changes: 6 additions & 2 deletions packages/protobuf/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,13 @@
"main": "./dist/cjs/index.js",
"exports": {
".": {
"node": {
"import": "./dist/proxy/index.js",
"require": "./dist/cjs/index.js"
},
"module": "./dist/esm/index.js",
"require": "./dist/cjs/index.js",
"import": "./dist/proxy/index.js"
"import": "./dist/esm/index.js",
"require": "./dist/cjs/index.js"
}
},
"devDependencies": {
Expand Down
16 changes: 12 additions & 4 deletions packages/protoplugin/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,22 @@
"main": "./dist/cjs/index.js",
"exports": {
".": {
"node": {
"import": "./dist/proxy/index.js",
"require": "./dist/cjs/index.js"
},
"module": "./dist/esm/index.js",
"require": "./dist/cjs/index.js",
"import": "./dist/proxy/index.js"
"import": "./dist/esm/index.js",
"require": "./dist/cjs/index.js"
},
"./ecmascript": {
"node": {
"import": "./dist/proxy/ecmascript/index.js",
"require": "./dist/cjs/ecmascript/index.js"
},
"module": "./dist/esm/ecmascript/index.js",
"require": "./dist/cjs/ecmascript/index.js",
"import": "./dist/proxy/ecmascript/index.js"
"import": "./dist/esm/ecmascript/index.js",
"require": "./dist/cjs/ecmascript/index.js"
}
},
"typesVersions": {
Expand Down

0 comments on commit 093967d

Please sign in to comment.