Type Error Importer
まだ誰も着手していません。
評価
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 初心者へのやさしさ
- 35/100
- issue の種類
- バグ
- 明瞭さ
- おおむね明確
- 活発さ
- 停滞
- 技術スタック
- rollup, typescript, vite
- 領域
- build-system
調査の方向性
vite.config.ts の例と StackBlitz の再現から始め、build.rollupOptions.plugins 内の nodePolyfills({ crypto: true }) に注目してください。TypeScript の非互換性を再現し、プラグインの Rollup フック型を調査してください。crypto オプションを維持したまま、報告された resolveId エラーなしで設定の型チェックが通れば完了です。
索引モデルが issue の本文から書いたものです。
説明
When I try to use nodePolyfills({ crypto: true }) as rollup option, i get following type error:
Type '{ name: string; resolveId(importee: string, importer: string): { id: any; moduleSideEffects: boolean; } | null; load(id: string): string | undefined; transform(code: string, id: string): any; }' is not assignable to type 'InputPluginOption'.
Type '{ name: string; resolveId(importee: string, importer: string): { id: any; moduleSideEffects: boolean; } | null; load(id: string): string | undefined; transform(code: string, id: string): any; }' is not assignable to type 'Plugin'.
Types of property 'resolveId' are incompatible.
Type '(importee: string, importer: string) => { id: any; moduleSideEffects: boolean; } | null' is not assignable to type 'ObjectHook<(this: PluginContext, source: string, importer: string | undefined, options: { assertions: Record<string, string>; custom?: CustomPluginOptions | undefined; isEntry: boolean; }) => ResolveIdResult | Promise<...>, {}> | undefined'.
Type '(importee: string, importer: string) => { id: any; moduleSideEffects: boolean; } | null' is not assignable to type '(this: PluginContext, source: string, importer: string | undefined, options: { assertions: Record<string, string>; custom?: CustomPluginOptions | undefined; isEntry: boolean; }) => ResolveIdResult | Promise<...>'.
Types of parameters 'importer' and 'importer' are incompatible.
Type 'string | undefined' is not assignable to type 'string'.
Type 'undefined' is not assignable to type 'string'.
28 plugins: [nodePolyfills()],
~~~~~~~~~~~~~~~
This is my vite.config.ts:
import { defineConfig } from 'vite';
import react from '@vitejs/plugin-react';
import { NodeGlobalsPolyfillPlugin } from '@esbuild-plugins/node-globals-polyfill';
import nodePolyfills from 'rollup-plugin-node-polyfills';
// https://vitejs.dev/config/
export default defineConfig({
server: {
port: 3000,
},
plugins: [react()],
resolve: {
alias: {
stream: 'rollup-plugin-node-polyfills/polyfills/stream',
events: 'rollup-plugin-node-polyfills/polyfills/events',
assert: 'assert',
crypto: 'crypto-browserify',
util: 'util',
'near-api-js': 'near-api-js/dist/near-api-js.js',
},
},
define: {
'process.env': process.env ?? {},
},
build: {
target: 'esnext',
rollupOptions: {
plugins: [nodePolyfills({ crypto: true })],
},
},
optimizeDeps: {
esbuildOptions: {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
plugins: [NodeGlobalsPolyfillPlugin({ buffer: true }) as any],
},
},
});
Replicated the issue here: https://stackblitz.com/edit/vitejs-vite-uqkmtp?file=vite.config.ts
Does anybody have an idea how to solve this?
- 主要言語
- JavaScript
- スター
- 142
- フォーク
- 64
- PR マージ指標
- 30日以内にマージされた PR はありません
環境構築
このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
ionic-team/rollup-plugin-node-polyfills のほかの issue
-
難易度 3/5 1〜2日 初心者へのやさしさ 35/100
ionic-team/rollup-plugin-node-polyfills#62 · コメント 2 件 · リアクション 6 件 ·
-
難易度 5/5 1週間以上 初心者へのやさしさ 25/100
ionic-team/rollup-plugin-node-polyfills#56 · リアクション 11 件 ·
-
難易度 3/5 1〜2日 初心者へのやさしさ 25/100
-
node:pathオープン
難易度 4/5 3〜5日 初心者へのやさしさ 20/100
ionic-team/rollup-plugin-node-polyfills#51 · リアクション 2 件 ·
-
<GIT>オープン
難易度 5/5 1週間以上 初心者へのやさしさ 20/100
ionic-team/rollup-plugin-node-polyfills の issue をすべて見る
似ている issue
-
[APP/MODULE]オープンenhancement
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
awesome-android-root/awesome-android-root#195 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
subhranshudash13-dotcom/Contribo#74 ·
メンテナーはふだん 1 日以内に返信
-
enhancement
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
qq15725/modern-screenshot#174 ·
-
難易度 1/5 1時間未満 初心者へのやさしさ 67/100
ThatGuySam/doesitarm#1114 ·