Skip to content

Commit 57fddde

Browse files
authored
Update jiti usage to use jiti.import() (#374)
* 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.
1 parent b5c627a commit 57fddde

File tree

3 files changed

+69
-66
lines changed

3 files changed

+69
-66
lines changed

packages/size-limit/get-config.js

+5-2
Original file line numberDiff line numberDiff line change
@@ -88,9 +88,12 @@ const dynamicImport = async filePath =>
8888

8989
const tsLoader = async filePath => {
9090
let jiti = (await import('jiti')).createJiti(fileURLToPath(import.meta.url), {
91-
interopDefault: true
91+
interopDefault: false
9292
})
93-
return jiti(filePath)
93+
94+
let config = await jiti.import(filePath)
95+
96+
return config?.default ?? config
9497
}
9598

9699
export default async function getConfig(plugins, process, args, pkg) {

packages/size-limit/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
"dependencies": {
2727
"bytes-iec": "^3.1.1",
2828
"chokidar": "^4.0.1",
29-
"jiti": "^2.0.0",
29+
"jiti": "^2.1.0",
3030
"lilconfig": "^3.1.2",
3131
"nanospinner": "^1.1.0",
3232
"picocolors": "^1.1.0",

pnpm-lock.yaml

+63-63
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)