From 725ee7bb2bd15ecbd2632cdd738269f5add93f49 Mon Sep 17 00:00:00 2001 From: Neko Ayaka Date: Mon, 3 Jun 2024 15:31:24 +0800 Subject: [PATCH] fix: build error Error [ERR_MODULE_NOT_FOUND] .vitepress/.temp/style.l0sNRNKZ.js MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cannot find module '/Users/neko/Git/nolebase/integrations/docs/.vitepress/.temp/style.l0sNRNKZ.js' imported from /Users/neko/Git/nolebase/integrations/docs/.vitepress/.temp/app.js Error [ERR_MODULE_NOT_FOUND]: Cannot find module '/Users/neko/Git/nolebase/integrations/docs/.vitepress/.temp/style.l0sNRNKZ.js' imported from /Users/neko/Git/nolebase/integrations/docs/.vitepress/.temp/app.js Already fixing: [Bug Report] 5.2.12 regression - dynamic css import will cause MODULE_NOT_FOUND in SSR build · Issue #17366 · vitejs/vite https://github.com/vitejs/vite/issues/17366 Signed-off-by: Neko Ayaka --- docs/.vitepress/theme/index.ts | 2 +- docs/package.json | 4 +- .../getting-started.md | 1 + .../index.md | 10 - .../configure-ui.md | 5 - .../configuration.md | 1 + .../getting-started.md | 1 + docs/pages/en/releases/migrations/v1-to-v2.md | 4 +- docs/pages/en/ui/asciinema-player/index.md | 14 +- docs/pages/en/ui/index.md | 2 +- .../en/ui/lazy-teleport-rive-canvas/index.md | 18 +- .../getting-started.md | 1 + .../index.md | 10 - .../configure-ui.md | 5 - .../configuration.md | 1 + .../getting-started.md | 1 + .../zh-CN/releases/migrations/v1-to-v2.md | 2 + docs/pages/zh-CN/ui/asciinema-player/index.md | 14 +- docs/pages/zh-CN/ui/index.md | 2 +- .../ui/lazy-teleport-rive-canvas/index.md | 18 +- docs/vite.config.ts | 4 +- package.json | 2 +- packages/markdown-it-unlazy-img/package.json | 2 +- packages/ui-asciinema/README.md | 54 ++++ packages/ui-asciinema/build.config.ts | 55 +++++ packages/ui-asciinema/package.json | 87 +++++++ .../{ui => ui-asciinema}/src/asciinema.d.ts | 0 .../src/components/NuAsciinemaPlayer.vue | 0 packages/ui-asciinema/src/index.ts | 5 + packages/ui-asciinema/tsconfig.json | 17 ++ packages/ui-rive-canvas/README.md | 54 ++++ packages/ui-rive-canvas/build.config.ts | 56 +++++ packages/ui-rive-canvas/package.json | 87 +++++++ .../components/NuLazyTeleportRiveCanvas.vue | 0 packages/ui-rive-canvas/src/index.ts | 5 + packages/ui-rive-canvas/tsconfig.json | 16 ++ packages/ui/README.md | 2 +- packages/ui/build.config.ts | 1 - packages/ui/package.json | 10 +- packages/ui/src/index.ts | 5 - packages/ui/tsconfig.json | 3 +- .../src/vite/git.ts | 5 - pnpm-lock.yaml | 230 +++++------------- tsconfig.json | 9 + 44 files changed, 563 insertions(+), 262 deletions(-) create mode 100644 packages/ui-asciinema/README.md create mode 100644 packages/ui-asciinema/build.config.ts create mode 100644 packages/ui-asciinema/package.json rename packages/{ui => ui-asciinema}/src/asciinema.d.ts (100%) rename packages/{ui => ui-asciinema}/src/components/NuAsciinemaPlayer.vue (100%) create mode 100644 packages/ui-asciinema/src/index.ts create mode 100644 packages/ui-asciinema/tsconfig.json create mode 100644 packages/ui-rive-canvas/README.md create mode 100644 packages/ui-rive-canvas/build.config.ts create mode 100644 packages/ui-rive-canvas/package.json rename packages/{ui => ui-rive-canvas}/src/components/NuLazyTeleportRiveCanvas.vue (100%) create mode 100644 packages/ui-rive-canvas/src/index.ts create mode 100644 packages/ui-rive-canvas/tsconfig.json diff --git a/docs/.vitepress/theme/index.ts b/docs/.vitepress/theme/index.ts index 4b01d377..3e5c0faa 100644 --- a/docs/.vitepress/theme/index.ts +++ b/docs/.vitepress/theme/index.ts @@ -3,7 +3,7 @@ import { type Plugin, h } from 'vue' import { MotionPlugin } from '@vueuse/motion' import TwoslashFloatingVue from '@shikijs/vitepress-twoslash/client' -import { NuLazyTeleportRiveCanvas } from '@nolebase/ui' +import { NuLazyTeleportRiveCanvas } from '@nolebase/ui-rive-canvas' import { defineThemeUnconfig } from '@nolebase/unconfig-vitepress' import { NolebasePluginPreset } from '@nolebase/unconfig-vitepress/plugins' diff --git a/docs/package.json b/docs/package.json index 45855025..89b88c52 100644 --- a/docs/package.json +++ b/docs/package.json @@ -20,6 +20,8 @@ "@nolebase/markdown-it-element-transform": "workspace:^", "@nolebase/markdown-it-unlazy-img": "workspace:^", "@nolebase/ui": "workspace:^", + "@nolebase/ui-asciinema": "workspace:^", + "@nolebase/ui-rive-canvas": "workspace:^", "@nolebase/unconfig-vitepress": "workspace:^", "@nolebase/vitepress-plugin-enhanced-mark": "workspace:^", "@nolebase/vitepress-plugin-enhanced-readabilities": "workspace:^", @@ -44,6 +46,6 @@ "motion": "^10.17.0", "thumbhash": "^0.1.1", "unlazy": "^0.11.3", - "vite-plugin-vue-devtools": "^7.2.1" + "vite-plugin-vue-devtools": "^7.1.3" } } diff --git a/docs/pages/en/integrations/markdown-it-bi-directional-links/getting-started.md b/docs/pages/en/integrations/markdown-it-bi-directional-links/getting-started.md index 3a9500cd..9d8ce45e 100644 --- a/docs/pages/en/integrations/markdown-it-bi-directional-links/getting-started.md +++ b/docs/pages/en/integrations/markdown-it-bi-directional-links/getting-started.md @@ -45,6 +45,7 @@ export default defineConfigWithTheme({ }, markdown: { config: (md) => { + // @ts-expect-error unmatched type for VitePress, ref https://github.com/nolebase/integrations/pull/228 [!code ++] md.use(BiDirectionalLinks()) // [!code ++] }, }, diff --git a/docs/pages/en/integrations/vitepress-plugin-enhanced-readabilities/index.md b/docs/pages/en/integrations/vitepress-plugin-enhanced-readabilities/index.md index 15dce85b..9ab7efaf 100644 --- a/docs/pages/en/integrations/vitepress-plugin-enhanced-readabilities/index.md +++ b/docs/pages/en/integrations/vitepress-plugin-enhanced-readabilities/index.md @@ -85,11 +85,6 @@ import { defineConfig } from 'vitepress' export default defineConfig({ vite: { // [!code ++] optimizeDeps: { // [!code ++] - include: [ // [!code ++] - // @rive-app/canvas is a CJS/UMD module, so it needs to be included here // [!code ++] - // for Vite to properly bundle it. // [!code ++] - '@nolebase/vitepress-plugin-enhanced-readabilities > @nolebase/ui > @rive-app/canvas', // [!code ++] - ], // [!code ++] exclude: [ // [!code ++] '@nolebase/vitepress-plugin-enhanced-readabilities/client', // [!code ++] ], // [!code ++] @@ -122,11 +117,6 @@ import { defineConfig } from 'vite' export default defineConfig(() => { return { optimizeDeps: { - include: [ // [!code ++] - // @rive-app/canvas is a CJS/UMD module, so it needs to be included here // [!code ++] - // for Vite to properly bundle it. // [!code ++] - '@nolebase/vitepress-plugin-enhanced-readabilities > @nolebase/ui > @rive-app/canvas', // [!code ++] - ], // [!code ++] exclude: [ // [!code ++] '@nolebase/vitepress-plugin-enhanced-readabilities/client', // [!code ++] 'vitepress' // [!code ++] diff --git a/docs/pages/en/integrations/vitepress-plugin-git-changelog/configure-ui.md b/docs/pages/en/integrations/vitepress-plugin-git-changelog/configure-ui.md index 44c0ddbe..f7ca3d13 100644 --- a/docs/pages/en/integrations/vitepress-plugin-git-changelog/configure-ui.md +++ b/docs/pages/en/integrations/vitepress-plugin-git-changelog/configure-ui.md @@ -405,11 +405,6 @@ import { defineConfig } from 'vite' export default defineConfig(() => { return { optimizeDeps: { - include: [ - // @rive-app/canvas is a CJS/UMD module, so it needs to be included here - // for Vite to properly bundle it. - '@nolebase/vitepress-plugin-git-changelog > @nolebase/ui > @rive-app/canvas', - ], exclude: [ '@nolebase/vitepress-plugin-git-changelog/client', ], diff --git a/docs/pages/en/integrations/vitepress-plugin-inline-link-preview/configuration.md b/docs/pages/en/integrations/vitepress-plugin-inline-link-preview/configuration.md index 346ce382..c9f63806 100644 --- a/docs/pages/en/integrations/vitepress-plugin-inline-link-preview/configuration.md +++ b/docs/pages/en/integrations/vitepress-plugin-inline-link-preview/configuration.md @@ -322,6 +322,7 @@ export default defineConfig({ markdown: { config(md) { // other markdown-it configurations... + // @ts-expect-error unmatched type for VitePress, ref https://github.com/nolebase/integrations/pull/228 [!code ++] md.use(InlineLinkPreviewElementTransform, { tag: 'YourComponentName' }) // [!code focus] } } diff --git a/docs/pages/en/integrations/vitepress-plugin-inline-link-preview/getting-started.md b/docs/pages/en/integrations/vitepress-plugin-inline-link-preview/getting-started.md index 161081a9..138edd74 100644 --- a/docs/pages/en/integrations/vitepress-plugin-inline-link-preview/getting-started.md +++ b/docs/pages/en/integrations/vitepress-plugin-inline-link-preview/getting-started.md @@ -57,6 +57,7 @@ export default defineConfig({ markdown: { // [!code ++] config(md) { // [!code ++] // other markdown-it configurations... // [!code ++] + // @ts-expect-error unmatched type for VitePress, ref https://github.com/nolebase/integrations/pull/228 [!code ++] md.use(InlineLinkPreviewElementTransform) // [!code ++] } // [!code ++] } // [!code ++] diff --git a/docs/pages/en/releases/migrations/v1-to-v2.md b/docs/pages/en/releases/migrations/v1-to-v2.md index 2b6fcaa7..f70ba212 100644 --- a/docs/pages/en/releases/migrations/v1-to-v2.md +++ b/docs/pages/en/releases/migrations/v1-to-v2.md @@ -71,6 +71,7 @@ export default defineConfig({ markdown: { // ... config: (md) => { + // @ts-expect-error unmatched type for VitePress, ref https://github.com/nolebase/integrations/pull/228 [!code ++] md.use(InlineLinkPreviewElementTransform) // [!code ++] }, }, @@ -119,6 +120,7 @@ export default defineConfig({ } as ElementTransformOptions // [!code --] })()) // [!code --] + // @ts-expect-error unmatched type for VitePress, ref https://github.com/nolebase/integrations/pull/228 [!code ++] md.use(InlineLinkPreviewElementTransform) // [!code ++] }, }, @@ -214,7 +216,7 @@ import '@nolebase/vitepress-plugin-highlight-targeted-heading/client/style.css' 1. `changelog.title` 2. `contributors.title`; 6. In order to better structure the organization of the i18n fields, the original - 1. `noLogs` i18n configuration changed to `changelog.noData`; + 1. `noLogs` i18n configuration changed to `changelog.noData`; 2. `noContributors` i18n configuration was changed to `contributors.noData`. 3. `lastEdited` i18n Configuration changed to `lastEdited`. 4. `lastEditedDateFnsLocaleName` configuration changed to `changelog.lastEditedDateFnsLocaleName` diff --git a/docs/pages/en/ui/asciinema-player/index.md b/docs/pages/en/ui/asciinema-player/index.md index 91dafd13..de1a957f 100644 --- a/docs/pages/en/ui/asciinema-player/index.md +++ b/docs/pages/en/ui/asciinema-player/index.md @@ -1,5 +1,5 @@ # Asciinema Player @@ -17,24 +17,24 @@ import { NuAsciinemaPlayer } from '@nolebase/ui' ## Installation -Install `@nolebase/ui` and `asciinema-player` to your project dependencies by running the following command: +Install `@nolebase/ui-asciinema` to your project dependencies by running the following command: ::: code-group ```shell [@antfu/ni] -ni @nolebase/ui asciinema-player +ni @nolebase/ui-asciinema ``` ```shell [pnpm] -pnpm add @nolebase/ui asciinema-player +pnpm add @nolebase/ui-asciinema ``` ```shell [npm] -npm install @nolebase/ui asciinema-player +npm install @nolebase/ui-asciinema ``` ```shell [yarn] -yarn add @nolebase/ui asciinema-player +yarn add @nolebase/ui-asciinema ``` ::: @@ -43,7 +43,7 @@ yarn add @nolebase/ui asciinema-player ```vue diff --git a/docs/pages/en/ui/index.md b/docs/pages/en/ui/index.md index daab2bd3..39c23d7b 100644 --- a/docs/pages/en/ui/index.md +++ b/docs/pages/en/ui/index.md @@ -34,7 +34,7 @@ export default defineConfig(() => { optimizeDeps: { // [!code ++] include: [ // [!code ++] // Add this line to your vite.config.ts's optimizeDeps.include array // [!code ++] - '@nolebase/ui > @rive-app/canvas', // [!code ++] + '@nolebase/ui-rive-canvas > @rive-app/canvas', // [!code ++] ], // [!code ++] }, // [!code ++] } diff --git a/docs/pages/en/ui/lazy-teleport-rive-canvas/index.md b/docs/pages/en/ui/lazy-teleport-rive-canvas/index.md index 99160afb..0c43be0c 100644 --- a/docs/pages/en/ui/lazy-teleport-rive-canvas/index.md +++ b/docs/pages/en/ui/lazy-teleport-rive-canvas/index.md @@ -31,24 +31,24 @@ Rive Canvas is a very special component. Unlike regular components, regular comp ## Installation -Install `@nolebase/ui` and `@rive-app/canvas` to your project dependencies by running the following command: +Install `@nolebase/ui-rive-canvas` to your project dependencies by running the following command: ::: code-group ```shell [@antfu/ni] -ni @nolebase/ui @rive-app/canvas +ni @nolebase/ui-rive-canvas ``` ```shell [pnpm] -pnpm add @nolebase/ui @rive-app/canvas +pnpm add @nolebase/ui-rive-canvas ``` ```shell [npm] -npm install @nolebase/ui @rive-app/canvas +npm install @nolebase/ui-rive-canvas ``` ```shell [yarn] -yarn add @nolebase/ui @rive-app/canvas +yarn add @nolebase/ui-rive-canvas ``` ::: @@ -63,7 +63,7 @@ First, you need to import the `NuLazyTeleportRiveCanvas` component in the Vue co import type { App } from 'vue' let app = null as unknown as App // ---cut--- -import { NuLazyTeleportRiveCanvas } from '@nolebase/ui'; +import { NuLazyTeleportRiveCanvas } from '@nolebase/ui-rive-canvas'; app.component('NuLazyTeleportRiveCanvas', NuLazyTeleportRiveCanvas); ``` @@ -80,7 +80,7 @@ export default defineConfig(() => { optimizeDeps: { // [!code ++] include: [ // [!code ++] // 添加这一行到你的 vite.config.ts 的 optimizeDeps.include 数组中 // [!code ++] - '@nolebase/ui @rive-app/canvas', // [!code ++] + '@nolebase/ui-rive-canvas > @rive-app/canvas', // [!code ++] ], // [!code ++] }, // [!code ++] } @@ -112,7 +112,7 @@ Then add the `` component in the entry file (`App.vu ```vue twoslash