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

Prevent entry files to be marked as externals #2382

Closed
Gin-Quin opened this issue Jul 11, 2022 · 3 comments
Closed

Prevent entry files to be marked as externals #2382

Gin-Quin opened this issue Jul 11, 2022 · 3 comments
Labels

Comments

@Gin-Quin
Copy link

Gin-Quin commented Jul 11, 2022

Presently, if an entry file matches of the external rules, the following error is raised:

[ERROR] The entry point "y.ts" cannot be marked as external

I created esrun, which is a Typescript runner that uses esbuild under the hood. For the sake of esm/cjs compatibility, dependencies are not bundled into the final executable. To achieve this, I mark the following files as externals:

  • "./node_modules/*"
  • "../node_modules/*"
  • "../../node_modules/*"
  • "../../../node_modules/*"
  • "../../../../node_modules/*"

btw, a better way to mark "all parent node_modules" would be great, but that's not the point of the issue

This works fine, until an esrun user tried to execute a file that is already inside a node_modules. The error is described in this issue. Then the entry file is also matching one of the external string so it raises the forementioned bug.

Two solutions come to me:

  • preventing one of the entry files to be marked as external even if they match (because it makes no sense to have an external entry file),
  • or add an "internal" parameter that takes strings / regexps / globs to describe files that should be treated as externals (even if they match).
@evanw
Copy link
Owner

evanw commented Jul 11, 2022

You're right, I should prevent entry files from being marked as external. I will do that in a future release.

@evanw
Copy link
Owner

evanw commented Dec 7, 2022

A fix for this has landed in master, so I'm closing this issue as fixed.

@evanw evanw closed this as completed Dec 7, 2022
@Gin-Quin
Copy link
Author

Gin-Quin commented Dec 7, 2022

Great! Thank you for the fix and the answer 💪

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants