-
-
Notifications
You must be signed in to change notification settings - Fork 106
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
Dots in custom TypeScript gulp file names break the compiler #219
Comments
To make the issue easier to debug I've attempted to make a failing test case in PR #220. |
@sttk can you take a look at this? |
@Dan503 There was no problem when I runned #220 with
|
Furthermore,
|
Hmmm... ok so the reduced test case appears to be working properly... This is the project that I am having the problem in: https://github.com/Dan503/gulp-auto-imports/tree/converting-gulp-files-to-typescript (Note it is on the "converting-gulp-files-to-typescript" branch, not the main branch) The The
Using I have "ts-node" and "typescript" installed, they are not being loaded though. I get the error as mentioned at the start of the issue. I don't see what is breaking the compiler in that project. |
Ahhh I found the issue. I have a dot in the file name in my project. I've pushed up a change in PR #220 to replicate the issue I am having. So the real issue is that dots in the middle of custom gulp file names confuse the code used to determine what type of gulp file it is. I'll update the issue name to reflect this. |
gulp --gulpfile customGulpFile.ts
does not import ts-node/register
gulp --gulpfile custom.GulpFile.ts
does not import ts-node/register
gulp --gulpfile custom.GulpFile.ts
does not import ts-node/register
@Dan503 I could reproduce the error of this issue. And as you said, the cause of the error is dots of the middle of the gulp file. For So gulp-cli cannot solve this problem in itself. However, because rechoir receives filepath and extension candidates, we would be able to solve this problem in rechoir. I'll address this next weekend. |
If I remember correctly, it was a design decision to handle multiple dot-separated extensions because node's module loader doesn't support it. This was done in gulpjs/rechoir#37 and might just be a bug |
@phated I remember that pr, too. But I forgot that liftoff doesn't yet update rechoir to latest. I confirmed that gulp behaved correctly about this issue by updating rechoir version of liftoff to 0.7.0. |
@sttk Oh! I remember that we didn't include it because there were other breaking changes. We should plan this for the 3.0 release of gulp-cli. I still want to completely rewrite liftoff to fit with how people are using interpret in webpack/etc. But I haven't found the time and we are no longer receiving much money to pay me for that time. |
Releasing in 3.0 is fine. This isn't a super urgent issue. Now that I know what the problem is, I've renamed my gulp files to remove the dots in the middle of their file names and everything is working as expected now. 😊 I'll keep this issue open though since it is still a bug, just a minor one that can probably be marked as a low priority. |
This Stack Overflow post explains how to use TypeScript on the primary gulp file.
Those steps work successfully for the main gulpfile.ts and outputs this line to the console when you run
gulp
What were you expecting to happen?
After running the following command:
I expect it to run
Requiring external module ts-node/register
like it does when compiling the main gulp file.What actually happened?
I run this command:
And I get the following error:
Please give us a sample of your gulpfile
The "converting-gulp-files-to-typescript" branch of my gulp-auto-imports repository demonstrates the bug.
Do the following steps to reproduce:
npm install
npm run generate
(uses the non-primary gulp files)A working version that is not using TypeScript can be found on the "feature/TypeScript-preset" branch.
Terminal output / screenshots
Please provide the following information:
node -v
): v12.18.2npm -v
): v6.14.5gulp -v
): CLI v2.3.0; Local v4.0.2The text was updated successfully, but these errors were encountered: