C# AOT compilation not setting "dotnet" to undefined
Nobody has claimed this yet.
Assessment
- Difficulty
- 1/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 88/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Quiet
- Tech stack
- csharp
- Domain
- build-system
Research direction
Start in NodeApi.targets and inspect the inline task that rewrites the generated JavaScript loader. Reproduce an AOT compilation and check the resulting loader for the netX.X import form shown in the issue. Done means the AOT output uses const dotnet = undefined; instead of importing node-api-dotnet/netX.X.
Written by the indexing model from the issue text.
Description
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!
- Dominant language
- C#
- Stars
- 783
- Forks
- 80
- PR merge metrics
- No merged PRs in 30d
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from microsoft/node-api-dotnet
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
microsoft/node-api-dotnet#481 ·
-
Difficulty 5/5 Over a week Newbie friendliness 35/100
microsoft/node-api-dotnet#486 · 1 comment ·
-
Difficulty 5/5 Over a week Newbie friendliness 35/100
microsoft/node-api-dotnet#483 · 1 comment · 1 reaction ·
-
Difficulty 4/5 3-5 days Newbie friendliness 45/100
microsoft/node-api-dotnet#479 ·
-
Difficulty 5/5 Over a week Newbie friendliness 35/100
microsoft/node-api-dotnet#475 · 1 comment ·
All issues in microsoft/node-api-dotnet
Similar issues
-
type/automation type/tech-debt
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
t/bug
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
-
ci-failure-cause test-failure
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
-
area:auth FE mvp P3
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
klasolsson81/jobbliggaren#1788 ·