Skip to content

Commit

Permalink
Update jiti usage to use jiti.import() (#374)
Browse files Browse the repository at this point in the history
* Bump `jiti` to version 2.1.0

* Use `jiti.import`

- We use `jiti.import` so we can load TS files that contain top-level `await` syntax.
  • Loading branch information
aryaemami59 authored Oct 2, 2024
1 parent b5c627a commit 57fddde
Show file tree
Hide file tree
Showing 3 changed files with 69 additions and 66 deletions.
7 changes: 5 additions & 2 deletions packages/size-limit/get-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,12 @@ const dynamicImport = async filePath =>

const tsLoader = async filePath => {
let jiti = (await import('jiti')).createJiti(fileURLToPath(import.meta.url), {
interopDefault: true
interopDefault: false
})
return jiti(filePath)

let config = await jiti.import(filePath)

return config?.default ?? config
}

export default async function getConfig(plugins, process, args, pkg) {
Expand Down
2 changes: 1 addition & 1 deletion packages/size-limit/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"dependencies": {
"bytes-iec": "^3.1.1",
"chokidar": "^4.0.1",
"jiti": "^2.0.0",
"jiti": "^2.1.0",
"lilconfig": "^3.1.2",
"nanospinner": "^1.1.0",
"picocolors": "^1.1.0",
Expand Down
126 changes: 63 additions & 63 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 57fddde

Please sign in to comment.