Skip to content

Commit f830cc8

Browse files
committed
Filter out default from named imports in size-limit config
1 parent ad80297 commit f830cc8

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

packages/toolkit/.size-limit.mts

+9-3
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,9 @@ const collectPackageJsonExports = (
5151
* @returns A promise that resolves to an array of unique package entry points.
5252
*/
5353
const getAllPackageEntryPoints = async () => {
54-
const packageJson = await import('./package.json', { with: { type: 'json' } })
54+
const packageJson = (
55+
await import('./package.json', { with: { type: 'json' } })
56+
).default
5557

5658
const packageExports = collectPackageJsonExports(packageJson.exports)
5759

@@ -73,7 +75,9 @@ const getAllImportsForEntryPoint = async (
7375
entryPoint: string,
7476
index: number,
7577
): Promise<SizeLimitConfig> => {
76-
const allNamedImports = Object.keys(await import(entryPoint))
78+
const allNamedImports = Object.keys(await import(entryPoint)).filter(
79+
(namedImport) => namedImport !== 'default',
80+
)
7781

7882
return allNamedImports
7983
.map<Check>((namedImport) => ({
@@ -142,7 +146,9 @@ const getAllImportsWithNodeEnv = async (nodeEnv: NodeEnv) => {
142146
* @returns A promise that resolves to the size limit configuration object.
143147
*/
144148
const getSizeLimitConfig = async (): Promise<SizeLimitConfig> => {
145-
const packageJson = await import('./package.json', { with: { type: 'json' } })
149+
const packageJson = (
150+
await import('./package.json', { with: { type: 'json' } })
151+
).default
146152

147153
const sizeLimitConfig = (
148154
await Promise.all(allNodeEnvs.map(getAllImportsWithNodeEnv))

0 commit comments

Comments
 (0)