Skip to content

Commit a58b18b

Browse files
authored
fix(devtools): Update ESM export extension (#5364)
* fix(devtools): Update ESM export extension * Update Svelte devtools types error * Fix svelte-query-devtools types error
1 parent 45a810c commit a58b18b

File tree

7 files changed

+11
-7
lines changed

7 files changed

+11
-7
lines changed

packages/query-devtools/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,11 @@
1212
},
1313
"types": "build/types/index.d.ts",
1414
"main": "build/umd/index.js",
15-
"module": "build/esm/index.js",
15+
"module": "build/esm/index.mjs",
1616
"exports": {
1717
".": {
1818
"types": "./build/types/index.d.ts",
19-
"import": "./build/esm/index.js",
19+
"import": "./build/esm/index.mjs",
2020
"require": "./build/umd/index.js",
2121
"default": "./build/umd/index.js"
2222
},

packages/svelte-query-devtools/src/Devtools.svelte

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
export let errorTypes: DevToolsErrorType[] = []
1818
1919
let ref: HTMLDivElement
20-
let devtools: TanstackQueryDevtools
20+
let devtools: TanstackQueryDevtools | undefined
2121
2222
if (DEV && BROWSER) {
2323
onMount(async () => {
@@ -37,7 +37,7 @@
3737
devtools.mount(ref)
3838
3939
return () => {
40-
devtools.unmount()
40+
devtools?.unmount()
4141
}
4242
})
4343
}

packages/svelte-query-devtools/tsconfig.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
"paths": {
3434
"@tanstack/query-core": ["../query-core/src"],
3535
"@tanstack/query-devtools": ["../query-devtools/src"],
36-
"@tanstack/svelte-query": ["../svelte-query/src"],
36+
"@tanstack/svelte-query": ["../svelte-query/src"]
3737
},
3838
"references": [
3939
{ "path": "../query-core" },

packages/svelte-query/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
],
3232
"scripts": {
3333
"clean": "rimraf ./build",
34-
"test:types": "svelte-check --tsconfig ./tsconfig.json",
34+
"test:types": "svelte-check --tsconfig ./tsconfig.json && tsc --emitDeclarationOnly --declaration --outDir build/lib",
3535
"test:eslint": "eslint --ext .svelte,.ts ./src",
3636
"test:lib": "vitest run --coverage",
3737
"test:lib:dev": "pnpm run test:lib --watch",

packages/svelte-query/tsconfig.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
"lib": ["esnext", "DOM", "DOM.Iterable"],
1313
"moduleResolution": "node",
1414
"module": "esnext",
15-
"noEmit": true,
1615
"noImplicitAny": true,
1716
"noImplicitReturns": true,
1817
"noImplicitThis": true,

rollup.config.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -499,6 +499,10 @@ function createTanstackQueryDevtoolsConfig() {
499499
outputs.forEach((output) => {
500500
const format = output.format
501501
output.dir = `${packageDir}/build/${format}`
502+
if (output.format === 'esm') {
503+
output.dir = undefined
504+
output.file = `${packageDir}/build/${format}/index.mjs`
505+
}
502506
})
503507

504508
solidRollupOptions.external = []

tsconfig.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
{ "path": "packages/react-query" },
1010
{ "path": "packages/react-query-devtools" },
1111
{ "path": "packages/react-query-persist-client" },
12+
{ "path": "packages/svelte-query" },
1213
{ "path": "packages/solid-query" },
1314
{ "path": "packages/vue-query" },
1415
{ "path": "packages/query-devtools" }

0 commit comments

Comments
 (0)