Dots in custom TypeScript gulp file names break the compiler
- Dominant language
- JavaScript
- Stars
- 408
- Forks
- 112
- PR merge metrics
- No merged PRs in 30d
Description
[This Stack Overflow post](https://stackoverflow.com/a/49849088/1611058) 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`
```
Requiring external module ts-node/register
```
### What were you expecting to happen?
After running the following command:
```
gulp --gulpfile customGulpFile.ts
```
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:
```
gulp --gulpfile customGulpFile.ts
```
And I get the following error:
```sh
import * as gulp from 'gulp'
^^^^^^
SyntaxError: Cannot use import statement outside a module
at wrapSafe (internal/modules/cjs/loader.js:1054:16)
at Module._compile (internal/modules/cjs/loader.js:1102:27)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1158:10)
at Module.load (internal/modules/cjs/loader.js:986:32)
at Function.Module._load (internal/modules/cjs/loader.js:879:14)
at Module.require (internal/modules/cjs/loader.js:1026:19)
at require (internal/modules/cjs/helpers.js:72:18)
at requireOrImport (xxxxxx\node_modules\gulp\node_modules\gulp-cli\lib\shared\require-or-import.js:19:11)
at execute (xxxxxx\node_modules\gulp\node_modules\gulp-cli\lib\versioned\^4.0.0\index.js:37:3)
at Liftoff.handleArguments (xxxxxx\node_modules\gulp\node_modules\gulp-cli\index.js:211:24)
```
### Please give us a sample of your gulpfile
The ["converting-gulp-files-to-typescript" branch](https://github.com/Dan503/gulp-auto-imports/tree/converting-gulp-files-to-typescript) of my gulp-auto-imports repository demonstrates the bug.
Do the following steps to reproduce:
1. Checkout/Fork the repo
2. Run `npm install`
3. Run `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](https://github.com/Dan503/gulp-auto-imports/tree/feature/TypeScript-preset).
### Terminal output / screenshots

### Please provide the following information:
* OS & version [e.g. MacOS Catalina 10.15.4]: Windows 10 Home v1909
* node version (run `node -v`): v12.18.2
* npm version (run `npm -v`): v6.14.5
* gulp version (run `gulp -v`): CLI v2.3.0; Local v4.0.2
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.