Closed NicoVogel closed 4 years ago
Hi.
At first glance i would has a guess it has something to do with the timing around WSL file system watch events. As TypeScript-Bundle is driven purely from the TSC CLI (and due to there not being any mechanism in the TSC CLI to signal when content has been written to disk), TypeScript-Bundle runs a file system watcher on the target output file --outFile
and when it sees the file has changed, it reads the content and rewrites it back with a AMD loader (that includes the define). If there is issues around these events, or latent events, it may skip over rewriting the content.
The relevant code for this can be found here, However im unable to test and reproduce WSL errors as I am currently don't have access to a Windows machine.
The issue you describe does seem like its watch event related however. TypeScript-Bundle seems to take the same code path when using --watch
and one off compilation. It might be possible to provide a direct code path for one off compilation that doesn't implicate file system watchers at all.
Hope this helps
Hi, Thank you for the quick response. This could be the issue and I will be looking into it a little more at some point. But for now, my workaround is to use Webpack, which requires more configuration than your tool.
I have an interesting problem where the define function is not added, but it only happens in my WSL2 Ubuntu 18.04.
SETUP
My result when using PS
My result when using WSL2 Ubuntu 18.04
System information
Ubuntu:
lsb_release -a
Windows:
winver
More information
I asked a few people to check this, but only I encounter the issue (non of them could check WSL2, only WSL1).
I have tried:
I don't know if the issue has anything to do with this repo, but its definitely strange. Do you have some form of verbose logging I can enable to dig deeper?