evanw / evanw/esbuild

Dynamic import of .ts files do not get transpiled

Open
#4,294 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
40.1k
Forks
1.3k
PR merge metrics
No merged PRs in 30d

Description

I am using the latest version of esbuild to bundle an application that dynamically tries to import a given .js file. When running I receive the following warning: ```[WARNING] The glob pattern import("./**/*.js") did not match any files [empty-glob]```

I was assuming that esbuild would transpile the .ts files to .js files and that the import wouldn't be a problem. Is this by design, and are there workarounds? Making the .ts files also entrypoints doesn't seem to make a difference.

The minimal reproduction can be seen [here](https://esbuild.github.io/try/#YgAwLjI1LjEwAHtidW5kbGU6IHRydWUsIGZvcm1hdDogJ2VzbScsIHRhcmdldDogJ2VzMjAyNCcsIG1pbmlmeTogdHJ1ZSwgb3V0ZGlyOiAnZGlzdCd9AGUAZW50cnkudHMAY29uc3QgbmFtZSA9ICJ0ZXN0IjsKaW1wb3J0IChgLi8ke25hbWV9LmpzYCkAZQBmb28udHMAAGUAZGVycC50cwA).

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the linked esbuild playground reproduction, which uses entry.ts, foo.ts, and dep.ts and dynamically imports a generated .js path. Read the reproduction and investigate how the glob pattern import is handled; done means determining whether the TypeScript files should be included or documenting the intended behavior and workaround.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, typescript
Domain
build-system, compilers
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.