microsoft / microsoft/node-api-dotnet

C# AOT compilation not setting "dotnet" to undefined

オープン 初心者向け
#484 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

主要言語
C#
スター
783
フォーク
80
PR マージ指標
30日以内にマージされた PR はありません

説明

Hello,

When compiling the module as AOT module then the resulting js module loaders is incorrect because:
import dotnet from 'node-api-dotnet/net10.0';
should have been:
const dotnet = undefined;

Poking around in the source code the problem is in NodeApi.targets which does:

    <Task>
      <Using Namespace="System.IO" />
      <Code Type="Fragment" Language="cs">
      <![CDATA[
        string js = File.ReadAllText(TargetFile);
        js = js.Replace("const dotnet = require('node-api-dotnet');", "const dotnet = undefined;");
        js = js.Replace("import dotnet from 'node-api-dotnet';", "const dotnet = undefined;");
        if (!IncludeRidSubpath) js = js.Replace("rid, ", "");
        File.WriteAllText(TargetFile, js);
      ]]>
      </Code>
    </Task>

but it should now replace "node-api-dotnet/netX.X" instead of just "node-api-dotnet"

Thanks!

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

NodeApi.targets から始め、生成された JavaScript ローダーを書き換える inline task を調べます。AOT コンパイルを再現し、結果のローダーに issue で示されている netX.X の import 形式があることを確認します。AOT 出力が node-api-dotnet/netX.X を import する代わりに const dotnet = undefined; を使用していれば完了です。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
csharp
領域
build-system
issue の種類
バグ
難易度
1/5
見積もり時間
1〜3時間
活発さ
静か
明瞭さ
明確に書かれている
初心者へのやさしさ
88/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。