Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/moody-terms-punch.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@qwik.dev/devtools': patch
---

fix: update type definitions and improve theme script import in devtools
2 changes: 1 addition & 1 deletion packages/devtools/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"./ui": {
"import": "./dist/ui/index.qwik.mjs",
"require": "./dist/ui/index.qwik.cjs",
"types": "./dist/ui/lib-types/index.d.ts"
"types": "./dist/ui/lib-types/ui/src/index.d.ts"
}
},
"files": [
Expand Down
3 changes: 2 additions & 1 deletion packages/plugin/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import VueInspector from 'vite-plugin-inspect'
import useCollectHooksSource from './utils/useCollectHooks'
import { parseQwikCode } from './parse/parse';
import { startPreloading } from './npm/index';
import updateConf from './utils/updateConf';


export function qwikDevtools(): Plugin[] {
Expand Down Expand Up @@ -41,7 +42,7 @@ export function qwikDevtools(): Plugin[] {
},
configResolved(viteConfig) {
_config = viteConfig;

updateConf(_config);
// Start preloading as early as possible, right after config is resolved
if (!preloadStarted) {
preloadStarted = true;
Expand Down
45 changes: 45 additions & 0 deletions packages/plugin/src/utils/updateConf.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
import { ResolvedConfig } from "vite";

function updateConf(conf: ResolvedConfig) {
const pkg = '@qwik.dev/devtools';

// Ensure ssr exists
// Some environments may have optional ssr in typed config
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
conf.ssr = conf.ssr ?? ({} as typeof conf.ssr);

const current = conf.ssr?.noExternal as unknown;

// If noExternal is not set (undefined/false), initialize as array
if (!current) {
conf.ssr.noExternal = [pkg];
return conf;
}

// If already true (do not externalize anything), nothing to do
if (current === true) {
return conf;
}

// If it's an array of entries, append if missing
if (Array.isArray(current)) {
if (!current.includes(pkg)) {
current.push(pkg);
}
return conf;
}

// If it's a string, convert to array and append
if (typeof current === 'string') {
conf.ssr.noExternal = current === pkg ? [pkg] : [current, pkg];
return conf;
}

// For other shapes (e.g., RegExp), preserve and extend via array wrapper
// This keeps existing behavior while ensuring our package is included
conf.ssr.noExternal = [current as never, pkg] as unknown as typeof conf.ssr.noExternal;
return conf;
}

export default updateConf;
4 changes: 2 additions & 2 deletions packages/ui/src/devtools.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ import { DevtoolsPanel } from './components/DevtoolsPanel/DevtoolsPanel';
import { Packages } from './features/Packages/Packages';
import { Inspect } from './features/inspect/Inspect';
import { ThemeToggle } from './components/ThemeToggle/ThemeToggle';
import { ThemeScript } from './components/ThemeToggle/theme-script';
import { ThemeScript as QwikThemeScript } from './components/ThemeToggle/theme-script';
import { CodeBreack } from './features/CodeBreack/CodeBreack';
function getClientRpcFunctions() {
return {
Expand Down Expand Up @@ -124,7 +124,7 @@ export const QwikDevtools = component$(() => {

return (
<>
<ThemeScript />
<QwikThemeScript />
<DevtoolsContainer>
<DevtoolsButton state={state} />

Expand Down
Loading