intlify / vue-i18n

Vue I18n for Vue 3

Home Page:https://vue-i18n.intlify.dev/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[v9.10.0] `@intlify/message-compiler` publishing missing TypeScript reference

shengslogar opened this issue · comments

Reporting a bug?

Beginning in v9.10.0 and persistent in v9.10.1, @intlify/message-compiler/dist/message-compiler.d.ts is publishing the following TS reference:

/// <reference types="node_modules/.pnpm/source-map-js@1.0.2/node_modules/source-map-js/source-map" />

https://www.npmjs.com/package/@intlify/message-compiler/v/9.10.0?activeTab=code

This causes TS to fail out when compilerOptions.skipLibCheck is set to false in your tsconfig.json.

Expected behavior

I scanned a diff of v9.9.1...v9.10.0 and couldn't see any obvious reason why this line was added, but my naive opinion is we shouldn't be assuming .pnpm is being used.

EDIT: I'm seeing now that PNPM is clearly the development tool for this repo. Not sure what the best practice is here for publishing references.

Expected behavior is to not have any TS references to files outside of the installed package and its dependencies.

Workaround for now is setting compilerOptions.skipLibCheck to true.

Reproduction

https://stackblitz.com/edit/vitejs-vite-1dmm1b?file=package.json

npm run build is automatically run, and you will see the following terminal output:

node_modules/@intlify/message-compiler/dist/message-compiler.d.ts:1:23 - error TS2688: Cannot find type definition file for 'node_modules/.pnpm/source-map-js@1.0.2/node_modules/source-map-js/source-map'.

1 /// <reference types="node_modules/.pnpm/source-map-js@1.0.2/node_modules/source-map-js/source-map" />
                        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Found 1 error in node_modules/@intlify/message-compiler/dist/message-compiler.d.ts:1

System Info

System:
    OS: Linux 5.0 undefined
    CPU: (8) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
    Memory: 0 Bytes / 0 Bytes
    Shell: 1.0 - /bin/jsh
  Binaries:
    Node: 18.18.0 - /usr/local/bin/node
    Yarn: 1.22.19 - /usr/local/bin/yarn
    npm: 10.2.3 - /usr/local/bin/npm
    pnpm: 8.15.3 - /usr/local/bin/pnpm
  npmPackages:
    @vitejs/plugin-vue: ^4.2.3 => 4.6.2 
    vite: ^4.4.9 => 4.5.2 
    vue: ^3.3.4 => 3.4.21 
    vue-i18n: 9.10.0 => 9.10.0
    vue-tsc: ^1.8.8 => 1.8.27

Screenshot

No response

Additional context

No response

Validations

I am getting the same behaviour with this package. @shengslogar Your workaround is working for now, thanks

Hmm 🤔, Apparently, after bumping to TS 5.3, the reference type is now embedded in the build file.
I am using api-extractor from d.ts. Maybe it is an issue it has.

@kazupon This was patched in v9.10.2 but regressed in v9.11.0.

Updated error output:

node_modules/@intlify/message-compiler/dist/message-compiler.d.ts:1:23 - error TS2688: Cannot find type definition file for '.pnpm/source-map-js@1.2.0/node_modules/source-map-js'.

1 /// <reference types=".pnpm/source-map-js@1.2.0/node_modules/source-map-js" />
                        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

node_modules/@intlify/message-compiler/dist/message-compiler.d.ts:2:23 - error TS2688: Cannot find type definition file for 'node_modules/.pnpm/source-map-js@1.0.2/node_modules/source-map-js/source-map'.

2 /// <reference types="node_modules/.pnpm/source-map-js@1.0.2/node_modules/source-map-js/source-map" />
                        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


Found 2 errors in the same file, starting at: node_modules/@intlify/message-compiler/dist/message-compiler.d.ts:1

Thanks!
I'm going to fix regression issue as new issue.