[question] How to use platform specific code in libs?
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 25/100
- issue の種類
- バグ
- 明瞭さ
- 説明が足りない
- 活発さ
- 静か
- 技術スタック
- typescript
- 領域
- build-system, tooling
調査の方向性
libs/nativescript-utils/src/index.ts とプラットフォーム固有のファイルから始め、次にライブラリの tsconfig.json および tsconfig.lib.json と、各アプリの tsconfig.app.json を比較します。TypeScript のコンパイルからファイルが欠落するエラーを再現し、どの設定がライブラリファイルの包含を制御しているかを追跡します。ライブラリからインポートしたときに .ios.ts と .android.ts の両方の実装がコンパイルされれば完了です。
索引モデルが issue の本文から書いたものです。
説明
It's me again :)
This time it's a question on how to do platform specific code in the libs. Here's my current issue:
I have these files under libs/nativescript-utils:
- src/lib/nativescript-utils.d.ts
export function nativescriptUtils(): string;
- src/lib/nativescript-utils.android.ts
- src/lib/nativescript-utils.ios.ts
- src/index.ts
export * from './lib/nativescript-utils';
Then I import the nativescriptUtils() in the app. When running the app I get this error:
ERROR in ../../libs/nativescript-utils/src/lib/nativescript-utils.ios.ts
Module build failed (from ../../node_modules/@ngtools/webpack/src/index.js):
Error: /Users/frank/git/private/nx-mobile-test/libs/nativescript-utils/src/lib/nativescript-utils.ios.ts is missing from the TypeScript compilation. Please make sure it is in your tsconfig via the 'files' or 'include' property.
at /Users/frank/git/private/nx-mobile-test/node_modules/@ngtools/webpack/src/ivy/loader.js:64:26
@ ../../libs/nativescript-utils/src/index.ts 1:0-41 1:0-41
@ ./src/features/home/components/home.component.ts 2:0-71 12:41-58
@ ./src/features/home/home.module.ts 5:0-50
@ ./src/app.routing.ts 15:28-65
@ ./src/app.module.ts 3:0-49 10:89-105
@ ./src/main.ts 6:0-41 11:69-78
I did the same exercise under apps, d.ts + ios.ts + android.ts + index.ts -> same issue -> solved it by adding "**/*.ios.ts" to includes in tsconfig.app.json. But no matter what I do in the libs and tsconfig.json or tsconfig.lib.json, it's not being picked up.
Do you have any tips on how to fix this?
- 主要言語
- TypeScript
- スター
- 68
- フォーク
- 15
- PR マージ指標
- 30日以内にマージされた PR はありません
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
NativeScript/nx のほかの issue
-
難易度 3/5 1〜2日 初心者へのやさしさ 65/100
NativeScript/nx#88 ·
-
難易度 3/5 1〜2日 初心者へのやさしさ 30/100
NativeScript/nx#84 · コメント 3 件 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 45/100
NativeScript/nx#80 ·
-
難易度 4/5 3〜5日 初心者へのやさしさ 25/100
NativeScript/nx#78 ·
-
難易度 4/5 3〜5日 初心者へのやさしさ 35/100
NativeScript/nx#76 ·
NativeScript/nx の issue をすべて見る
似ている issue
-
clawsweeper:fix-shape-clear clawsweeper:queueable-fix clawsweeper:source-repro impact:ux-friction issue-rating: 🦞 diamond lobster no-stale P3
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
-
community first-timers-only good first issue hacktoberfest help wanted low hanging fruit up-for-grabs
難易度 1/5 1時間未満 初心者へのやさしさ 76/100
-
code-quality refactoring
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
github/gh-aw-firewall#8816 ·
-
integration:quickjs org:external priority:backlog topic:code-interpreter topic:middleware type:feature
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
langchain-ai/deepagents#6450 ·
-
難易度 1/5 1時間未満 初心者へのやさしさ 88/100
vercel/react-tweet#225 ·