Skip to content

Commit 30819d6

Browse files
committed
chore: disable devtools
1 parent 5cc392b commit 30819d6

File tree

3 files changed

+54
-54
lines changed

3 files changed

+54
-54
lines changed

pnpm-workspace.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
packages:
22
- "./"
33
- "playground"
4-
# - "docs"
5-
# - "client"
4+
- "docs"
5+
- "client"

src/devtools.ts

Lines changed: 47 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -1,51 +1,51 @@
1-
import { existsSync } from 'node:fs'
2-
import type { Resolver } from '@nuxt/kit'
3-
import type { Nuxt } from 'nuxt/schema'
1+
// import { existsSync } from 'node:fs'
2+
// import type { Resolver } from '@nuxt/kit'
3+
// import type { Nuxt } from 'nuxt/schema'
44

5-
const DEVTOOLS_UI_ROUTE = '/__codemirror_nuxt_devtools'
6-
const DEVTOOLS_UI_LOCAL_PORT = 3300
5+
// const DEVTOOLS_UI_ROUTE = '/__codemirror_nuxt_devtools'
6+
// const DEVTOOLS_UI_LOCAL_PORT = 3300
77

8-
export function setupDevToolsUI(nuxt: Nuxt, resolver: Resolver) {
9-
const clientPath = resolver.resolve('./client')
10-
const isProductionBuild = existsSync(clientPath)
8+
// export function setupDevToolsUI(nuxt: Nuxt, resolver: Resolver) {
9+
// const clientPath = resolver.resolve('./client')
10+
// const isProductionBuild = existsSync(clientPath)
1111

12-
// Serve production-built client (used when package is published)
13-
if (isProductionBuild) {
14-
nuxt.hook('vite:serverCreated', async (server) => {
15-
const sirv = await import('sirv').then(r => r.default || r)
16-
server.middlewares.use(
17-
DEVTOOLS_UI_ROUTE,
18-
sirv(clientPath, { dev: true, single: true }),
19-
)
20-
})
21-
}
22-
// In local development, start a separate Nuxt Server and proxy to serve the client
23-
else {
24-
nuxt.hook('vite:extendConfig', (config) => {
25-
config.server = config.server || {}
26-
config.server.proxy = config.server.proxy || {}
27-
config.server.proxy[DEVTOOLS_UI_ROUTE] = {
28-
target: `http://localhost:${DEVTOOLS_UI_LOCAL_PORT}${DEVTOOLS_UI_ROUTE}`,
29-
changeOrigin: true,
30-
followRedirects: true,
31-
rewrite: path => path.replace(DEVTOOLS_UI_ROUTE, ''),
32-
}
33-
})
34-
}
12+
// Serve production-built client (used when package is published)
13+
// if (isProductionBuild) {
14+
// nuxt.hook('vite:serverCreated', async (server) => {
15+
// const sirv = await import('sirv').then(r => r.default || r)
16+
// server.middlewares.use(
17+
// DEVTOOLS_UI_ROUTE,
18+
// sirv(clientPath, { dev: true, single: true }),
19+
// )
20+
// })
21+
// }
22+
// In local development, start a separate Nuxt Server and proxy to serve the client
23+
// else {
24+
// nuxt.hook('vite:extendConfig', (config) => {
25+
// config.server = config.server || {}
26+
// config.server.proxy = config.server.proxy || {}
27+
// config.server.proxy[DEVTOOLS_UI_ROUTE] = {
28+
// target: `http://localhost:${DEVTOOLS_UI_LOCAL_PORT}${DEVTOOLS_UI_ROUTE}`,
29+
// changeOrigin: true,
30+
// followRedirects: true,
31+
// rewrite: path => path.replace(DEVTOOLS_UI_ROUTE, ''),
32+
// }
33+
// })
34+
// }
3535

36-
nuxt.hook('devtools:customTabs', (tabs) => {
37-
tabs.push({
38-
// unique identifier
39-
name: 'codemirror-nuxt-devtools',
40-
// title to display in the tab
41-
title: 'CodeMirror DevTools',
42-
// any icon from Iconify, or a URL to an image
43-
icon: 'i-carbon-code',
44-
// iframe view
45-
view: {
46-
type: 'iframe',
47-
src: DEVTOOLS_UI_ROUTE,
48-
},
49-
})
50-
})
51-
}
36+
// nuxt.hook('devtools:customTabs', (tabs) => {
37+
// tabs.push({
38+
// // unique identifier
39+
// name: 'codemirror-nuxt-devtools',
40+
// // title to display in the tab
41+
// title: 'CodeMirror DevTools',
42+
// // any icon from Iconify, or a URL to an image
43+
// icon: 'i-carbon-code',
44+
// // iframe view
45+
// view: {
46+
// type: 'iframe',
47+
// src: DEVTOOLS_UI_ROUTE,
48+
// },
49+
// })
50+
// })
51+
// }

src/module.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { defineNuxtModule, addComponent, createResolver, addImports, extendViteConfig, addTypeTemplate } from '@nuxt/kit'
2-
import { setupDevToolsUI } from './devtools'
2+
// import { setupDevToolsUI } from './devtools'
33

44
export interface ModuleOptions {
55
devtools?: boolean
@@ -11,15 +11,15 @@ export default defineNuxtModule({
1111
configKey: 'nuxtCodemirror',
1212
},
1313
defaults: {
14-
devtools: false,
14+
// devtools: false,
1515
},
1616
setup(_options, _nuxt) {
1717
const resolver = createResolver(import.meta.url)
1818
_nuxt.options.alias['#codemirror'] = resolver.resolve('./runtime')
1919

20-
if (_options.devtools) {
21-
setupDevToolsUI(_nuxt, resolver)
22-
}
20+
// if (_options.devtools) {
21+
// setupDevToolsUI(_nuxt, resolver)
22+
// }
2323

2424
addComponent({
2525
name: 'NuxtCodeMirror',

0 commit comments

Comments
 (0)