intuit / intuit/auto

auto.config.ts breaks when tsconfig.json "module" is "es2015"

Open
#1,943 5 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
TypeScript
Stars
2.5k
Forks
221
PR merge metrics
No merged PRs in 30d

Description

**Describe the bug**

It seems that _auto.config.ts_ as described in the docs doesn't when user's project specifies `"module": "es2015"` (not `"commonjs"`) in its _tsconfig.json_.

This is a problem upstream in _@endemolshinegroup/cosmiconfig-typescript-loader_, but I wanted to leave this issue here for other people encountering the error.

**To Reproduce**

A fast way:

1. Copy auto.config.ts to your nearest project with auto.
2. Change your tsconfig.json module setting to one preserving ES6 imports (e.g. `"es2015"`)

A way I'm 100% sure will crash as expected:

1. Clone https://github.com/system-ui/theme-ui
2. Checkout `3a92b715cb83481004dd91b8fe19d5147711411a`
3. Run `yarn auto shipit`

**Expected behavior**

Config copied from the docs works.

**Screenshots**

```
⇝ yarn auto shipit
yarn run v1.22.5
$ /home/hasparus/workspace/theme-ui/node_modules/.bin/auto shipit
TypeScriptCompileError: Failed to compile TypeScript: Unexpected token 'export'
at Function.TypeScriptCompileError.fromError (/home/hasparus/workspace/theme-ui/node_modules/@endemolshinegroup/cosmiconfig-typescript-loader/src/Errors/TypeScriptCompileError.ts:20:12)
```

**Environment information:**

I don't expect it to be relevant but info crashes too.
Should `info` command crash when the config is broken?

```txt
$ /home/hasparus/workspace/theme-ui/node_modules/.bin/auto info
TypeScriptCompileError: Failed to compile TypeScript: Unexpected token 'export'
at Function.TypeScriptCompileError.fromError (/home/hasparus/workspace/theme-ui/node_modules/@endemolshinegroup/cosmiconfig-typescript-loader/src/Errors/TypeScriptCompileError.ts:20:12)
at /home/hasparus/workspace/theme-ui/node_modules/@endemolshinegroup/cosmiconfig-typescript-loader/src/index.ts:14:34
at Generator.next ()
at /home/hasparus/workspace/theme-ui/node_modules/@endemolshinegroup/cosmiconfig-typescript-loader/node_modules/tslib/tslib.js:117:75
at new Promise ()
at Object.__awaiter (/home/hasparus/workspace/theme-ui/node_modules/@endemolshinegroup/cosmiconfig-typescript-loader/node_modules/tslib/tslib.js:113:16)
at loader (/home/hasparus/workspace/theme-ui/node_modules/@endemolshinegroup/cosmiconfig-typescript-loader/src/index.ts:6:51)
at Explorer.loadFileContent (/home/hasparus/workspace/theme-ui/node_modules/cosmiconfig/src/Explorer.ts:81:32)
at Explorer.createCosmiconfigResult (/home/hasparus/workspace/theme-ui/node_modules/cosmiconfig/src/Explorer.ts:89:36)
at Explorer.loadSearchPlace (/home/hasparus/workspace/theme-ui/node_modules/cosmiconfig/src/Explorer.ts:65:31)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
```

**actual result after I edited comiconfig code**

```
⇝ yarn auto info
yarn run v1.22.5
$ /home/hasparus/workspace/theme-ui/node_modules/.bin/auto info

Environment Information:

"auto" version: v10.25.0
"git" version: v2.27.0
"node" version: v14.15.3

Project Information:

✔ Repository: system-ui/theme-ui
✔ Author Name: hasparus
✔ Author Email: hasparus@gmail.com
✔ Current Version: v0.6.2
✔ Latest Release: v0.6.2

✔ Labels configured on GitHub project

GitHub Token Information:

✔ Token: [Token starting with 6cf3]
✔ Repo Permission: admin
✔ User: hasparus
✔ API:
✔ Enabled Scopes: admin:org, admin:org_hook, admin:public_key, admin:repo_hook, gist, notifications, repo, user, workflow
✔ Rate Limit: 4934/5000

```

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reproducing the failure with auto.config.ts, a tsconfig.json using module "es2015", and the documented yarn auto shipit or yarn auto info commands. Read the configuration-loading path and the reported @endemolshinegroup/cosmiconfig-typescript-loader entry points; done means establishing whether this repository can handle the configuration or must update the upstream dependency, with the command succeeding.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
cli, release
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.