Skip to content

fix(protobuf-rpc): gen files and publish config#7

Merged
iwwwanow merged 3 commits intomasterfrom
fix/protobuf-rpc-gen
Apr 3, 2025
Merged

fix(protobuf-rpc): gen files and publish config#7
iwwwanow merged 3 commits intomasterfrom
fix/protobuf-rpc-gen

Conversation

@Amiditin
Copy link
Member

@Amiditin Amiditin commented Apr 3, 2025

  • перегенерированы протосы и исправлены связанные ts ошибки
  • фикс паблиш конфига

@Amiditin Amiditin added the bug label Apr 3, 2025
@Amiditin Amiditin requested a review from iwwwanow April 3, 2025 00:09
@Amiditin Amiditin self-assigned this Apr 3, 2025
@Amiditin
Copy link
Member Author

Amiditin commented Apr 3, 2025

@iwwwanow в этом PR #5 в коммите ccabf29 паблиш конфиг сделал в виде:

  "publishConfig": {
    "access": "public",
    "exports": {
      "./package.json": "./package.json",
      ".": {
        "import": "./dist/cjs/index.js",
        "types": "./dist/index.d.ts",
        "default": "./dist/cjs/index.js"
      }
    },
    "main": "dist/cjs/index.js",
    "typings": "dist/index.d.ts"
  }

Вопрос, почему для es модулей используешь cjs файлы? Почему не используется "require": "./dist/cjs/index.js" опция экспорта для cjs? Из-за такого конфига в тестах при импорте падают ошибки вида

Details

┌────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
│                                                                                                                                                                                            │
│  files/service/service-entrypoint/integration/files-engine.rpc.test.ts:0:0                                                                                                                 │
│                                                                                                                                                                                            │
│────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────│
│                                                                                                                                                                                            │
│  file:///home/amiditin/React/atls-services/.yarn/__virtual__/@atls-protobuf-rpc-virtual-fa5777dd64/2/.yarn/berry/cache/@atls-protobuf-rpc-npm-0.0.4-9597085ede-10.zip/node_modules/@atls/  │
│  protobuf-rpc/dist/cjs/index.js:17                                                                                                                                                         │
│  module.exports = __toCommonJS(index_exports);                                                                                                                                             │
│  ^                                                                                                                                                                                         │
│  ReferenceError: module is not defined in ES module scope                                                                                                                                  │
│      at file:///home/amiditin/React/atls-services/.yarn/__virtual__/@atls-protobuf-rpc-virtual-fa5777dd64/2/.yarn/berry/cache/@atls-protobuf-rpc-npm-0.0.4-9597085ede-10.zip/node_modules  │
│  /@atls/protobuf-rpc/dist/cjs/index.js:17:1                                                                                                                                                │
│      at ModuleJob.run (node:internal/modules/esm/module_job:271:25)                                                                                                                        │
│      at async onImport.tracePromise.__proto__ (node:internal/modules/esm/loader:547:26)                                                                                                    │
│      at async asyncRunEntryPointWithESMLoader (node:internal/modules/run_main:116:5)                                                                                                       │
│  Node.js v22.12.0                                                                                                                                                                          │
│                                                                                                                                                                                            │
└─

Copy link
Contributor

@iwwwanow iwwwanow left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

по всей видимости прогладел

@iwwwanow iwwwanow merged commit 9164d14 into master Apr 3, 2025
6 checks passed
@iwwwanow iwwwanow deleted the fix/protobuf-rpc-gen branch April 3, 2025 09:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants