Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix entry point conflict with actually exist file #549

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions server/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,17 @@ func (task *BuildTask) ID() string {

if pkg.Submodule != "" {
name = pkg.Submodule
} else {
pack, _ := fetchPackageInfo(pkg.Name, pkg.Version)
Copy link
Member

@ije ije Mar 16, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • pls handle the error in case pack is nil.
  • consider the "." of exports

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, Will fix these cases tomorrow
Fixing pack is nil is difficult in the ID method coz the method is called in many places.
I think can refactor the logic of the build later.


if pack.Module != "" {
name = strings.TrimSuffix(pack.Module, filepath.Ext(pack.Module))
} else if pack.Main != "" {
name = strings.TrimSuffix(pack.Main, filepath.Ext(pack.Main))
}

}

name = strings.TrimSuffix(name, ".js")
if task.DevMode {
name += ".development"
Expand Down
7 changes: 7 additions & 0 deletions test/correct-entry-point/correct-entry-point.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { assertExists } from "https://deno.land/std@0.178.0/testing/asserts.ts";

import * as graphql from 'http://localhost:8080/graphql@16.6.0'

Deno.test("Correct entry point", async () => {
assertExists(graphql.GraphQLNonNull);
});