-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: make input_schema fully ESM usable 馃槩 (#448)
Don't you love CJS/ESM state in nodejs Needed for apify/apify-cli#477
- Loading branch information
1 parent
95b728f
commit fe75f79
Showing
2 changed files
with
16 additions
and
1 deletion.
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,15 @@ | ||
// The fact this is needed makes Vlad cry. | ||
import { readFileSync, writeFileSync } from 'fs'; | ||
import { resolve } from 'path'; | ||
|
||
const file = resolve(__dirname, '..', 'dist', 'esm', 'index.mjs'); | ||
|
||
const fileContent = readFileSync(file, 'utf8'); | ||
const fixed = fileContent | ||
.replace( | ||
'import { parseScript } from "escaya";', | ||
`import escaya from "escaya"; | ||
const { parseScript } = escaya;`, | ||
); | ||
|
||
writeFileSync(file, fixed); |