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

Alternative tsconfig.json #37

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

Pirosauro
Copy link

See #36

  • added the --tsconfig CLI flag
  • the tsconfig is now passed as parameter to esbuild

src/cli.ts Outdated
@@ -96,6 +102,7 @@ const cwd = process.cwd();
*/
const sourcePath = normalizePath(argv.flags.src, true);
const distPath = normalizePath(argv.flags.dist, true);
const tsconfig = getTsconfig(undefined, argv.flags.tsconfig);
Copy link
Owner

Choose a reason for hiding this comment

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

parseTsconfig should be used here. getTsconfig searches for a tsconfig.json file, but parseTsconfig parses the tsconfig.json at a given path.

Example:
https://github.com/esbuild-kit/cjs-loader/blob/94a69f9e6d41225cb8a132938a3b9b077c15f966/src/index.ts#L23

@privatenumber
Copy link
Owner

Thanks for the PR! Can you add a test?

@@ -96,8 +102,9 @@ const cwd = process.cwd();
*/
const sourcePath = normalizePath(argv.flags.src, true);
const distPath = normalizePath(argv.flags.dist, true);
const tsconfig = parseTsconfig(argv.flags.tsconfig);
Copy link
Owner

Choose a reason for hiding this comment

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

While parseTsconfig should be used if a tsconfig file is passed in, it should default to getTsconfig if it's not passed in.

For reference, it should look like this:
https://github.com/esbuild-kit/esm-loader/blob/332a0a0220dbb80de806ebb3a15ec7c3ce893bee/src/utils.ts#L13-L20

@privatenumber privatenumber changed the base branch from develop to master April 28, 2024 21:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants