auto.config.ts breaks when tsconfig.json "module" is "es2015"
See original GitHub issueDescribe 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:
- Copy auto.config.ts to your nearest project with auto.
- Change your tsconfig.json module setting to one preserving ES6 imports (e.g.
"es2015"
)
A way I’m 100% sure will crash as expected:
- Clone https://github.com/system-ui/theme-ui
- Checkout
3a92b715cb83481004dd91b8fe19d5147711411a
- 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?
$ /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 (<anonymous>)
at /home/hasparus/workspace/theme-ui/node_modules/@endemolshinegroup/cosmiconfig-typescript-loader/node_modules/tslib/tslib.js:117:75
at new Promise (<anonymous>)
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
Issue Analytics
- State:
- Created 2 years ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
TSConfig Reference - Docs on every TSConfig option
Offers a way to configure the root directory for where declaration files are emitted. example ├── index.ts ├── package.json └── tsconfig.json.
Read more >Typescript does not resolve modules through tsconfig.json's ...
The problem is that you have "files":[] section that only includes a file from typings. If there is a 'files' section in tsconfig.json,...
Read more >Overriding `tsconfig.json` for ts-node in mocha - Stack Overflow
You need to set the configuration through the TS_NODE_COMPILER_OPTIONS environment variable. Example code on an unix machine:
Read more >Understanding TypeScript Configuration Options
This post will walk you through how tsconfig.json works in your ... TypeScript will automatically compile all files ( .ts, .tsx ) in...
Read more >Understanding TypeScript's “Compilation Process” & the ...
ts ) into JavaScript. However, the tsc compiler (short for TypeScript compiler) needs a JSON configuration file to look for TypeScript files in ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
You don’t realize how much time you saved me with auto. I made a first automatic stable release today (after using patch-package to work around this issue), and the only things I had to do were reformatting the changelog and writing an announcement on Discord. This a drastic improvement to my life. Thank you once again.
If you want to contribute a discord plugin I’d be all for it 😄