|
7 | 7 | addImports,
|
8 | 8 | addComponentsDir,
|
9 | 9 | addTemplate,
|
10 |
| - addComponent |
| 10 | + extendViteConfig |
11 | 11 | } from '@nuxt/kit'
|
12 | 12 | import { genImport, genSafeVariableName } from 'knitwork'
|
13 | 13 | import type { ListenOptions } from 'listhen'
|
@@ -247,16 +247,13 @@ export default defineNuxtModule<ModuleOptions>({
|
247 | 247 | }
|
248 | 248 |
|
249 | 249 | // Add Vite configurations
|
250 |
| - if (nuxt.options.vite !== false) { |
251 |
| - nuxt.options.vite = defu( |
252 |
| - nuxt.options.vite === true ? {} : nuxt.options.vite, |
253 |
| - { |
254 |
| - optimizeDeps: { |
255 |
| - include: ['html-tags'] |
256 |
| - } |
257 |
| - } |
| 250 | + extendViteConfig((config) => { |
| 251 | + config.optimizeDeps = config.optimizeDeps || {} |
| 252 | + config.optimizeDeps.include = config.optimizeDeps.include || [] |
| 253 | + config.optimizeDeps.include.push( |
| 254 | + 'html-tags' |
258 | 255 | )
|
259 |
| - } |
| 256 | + }) |
260 | 257 |
|
261 | 258 | // Add Content plugin
|
262 | 259 | addPlugin(resolveRuntimeModule('./plugins/ws'))
|
@@ -553,34 +550,6 @@ export default defineNuxtModule<ModuleOptions>({
|
553 | 550 | tailwindConfig.content.push(resolve(nuxt.options.buildDir, 'content-cache', 'parsed/**/*.md'))
|
554 | 551 | })
|
555 | 552 |
|
556 |
| - // Experimental preview mode |
557 |
| - if (process.env.NUXT_PREVIEW_API) { |
558 |
| - // Add preview plugin |
559 |
| - addPlugin(resolveRuntimeModule('./preview/preview-plugin')) |
560 |
| - |
561 |
| - // Add preview components |
562 |
| - addComponent({ |
563 |
| - name: 'ContentPreviewMode', |
564 |
| - filePath: resolveRuntimeModule('./preview/components/ContentPreviewMode.vue') |
565 |
| - }) |
566 |
| - |
567 |
| - // @ts-ignore |
568 |
| - nuxt.options.runtimeConfig.public.content.previewAPI = process.env.NUXT_PREVIEW_API |
569 |
| - // @ts-ignore |
570 |
| - nuxt.options.runtimeConfig.content.previewAPI = process.env.NUXT_PREVIEW_API |
571 |
| - |
572 |
| - if (nuxt.options.vite !== false) { |
573 |
| - nuxt.options.vite = defu( |
574 |
| - nuxt.options.vite === true ? {} : nuxt.options.vite, |
575 |
| - { |
576 |
| - optimizeDeps: { |
577 |
| - include: ['socket.io-client', 'slugify'] |
578 |
| - } |
579 |
| - } |
580 |
| - ) |
581 |
| - } |
582 |
| - } |
583 |
| - |
584 | 553 | // Setup content dev module
|
585 | 554 | if (!nuxt.options.dev) {
|
586 | 555 | nuxt.hook('build:before', async () => {
|
@@ -684,8 +653,6 @@ interface ModulePrivateRuntimeConfig {
|
684 | 653 | */
|
685 | 654 | cacheVersion: string;
|
686 | 655 | cacheIntegrity: string;
|
687 |
| - |
688 |
| - previewAPI?: string |
689 | 656 | }
|
690 | 657 |
|
691 | 658 | declare module '@nuxt/schema' {
|
|
0 commit comments