-
Notifications
You must be signed in to change notification settings - Fork 1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
eb47837
commit b29af84
Showing
4 changed files
with
42 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
let fs = require('fs/promises') | ||
let path = require('path') | ||
|
||
/** | ||
* Everything in the Headless UI codebase is written in TypeScript, however the | ||
* `@headlessui/tailwindcss` plugin has to compile to a CommonJs file. This works great, however | ||
* the types that were generated by tsc use `export default _default` instead of `export = | ||
* _default` even if we use `module: CommonJs` in the `tsconfig.json` | ||
* | ||
* Don't want to spend too much time on this problem, so doing this little hack to change the | ||
* exported type. This allows us to use the `@headlessui/tailwindcss` plugin and have types in a | ||
* CommonJs environment. | ||
**/ | ||
|
||
let types = path.resolve(__dirname, '..', 'dist', 'index.d.ts') | ||
|
||
async function run() { | ||
let contents = await fs.readFile(types, 'utf8') | ||
contents = contents.replace('export default', 'export =') | ||
await fs.writeFile(types, contents, 'utf8') | ||
} | ||
|
||
run() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters