Skip to content

Vitepress and rolldown-vite throw error when enabling native plugin #100

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
7 tasks done
TheAlexLichter opened this issue Apr 2, 2025 · 2 comments
Open
7 tasks done
Assignees
Labels
feat: native plugins related to exprimental.enableNativePlugins

Comments

@TheAlexLichter
Copy link
Collaborator

TheAlexLichter commented Apr 2, 2025

Describe the bug

Trying to override vite with rolldown-vite in a plain VitePress project works well, in dev and in build. When using the native plugin though, dev and build fail with errors

Dev

Pre-transform error: Failed to resolve import "@theme/index" from "node_modules/.pnpm/[email protected]_@[email protected][email protected][email protected]/node_modules/vitepress/dist/client/app/index.js?v=05a25038". Does the file exist?
Full Error log (dev)
> vitepress-project@ dev /home/alichter/Programming/vitepress-rolldown-test
> vitepress dev docs


  vitepress v1.6.3

  ➜  Local:   http://localhost:5173/
  ➜  Network: use --host to expose
  ➜  press h to show help
2:06:16 PM [vitepress] Pre-transform error: Failed to resolve import "@theme/index" from "node_modules/.pnpm/[email protected]_@[email protected][email protected][email protected]/node_modules/vitepress/dist/client/app/index.js?v=05a25038". Does the file exist?
  Plugin: vite:import-analysis
  File: /home/alichter/Programming/vitepress-rolldown-test/node_modules/.pnpm/[email protected]_@[email protected][email protected][email protected]/node_modules/vitepress/dist/client/app/index.js?v=05a25038:1:23
  1  |  import RawTheme from '@theme/index';
     |                        ^
  2  |  import { createApp as createClientApp, createSSRApp, defineComponent, h, onMounted, watchEffect } from 'vue';
  3  |  import { ClientOnly } from './components/ClientOnly';
2:06:16 PM [vitepress] (client) Pre-transform error: Failed to resolve import "@siteData" from "node_modules/.pnpm/[email protected]_@[email protected][email protected][email protected]/node_modules/vitepress/dist/client/app/data.js?v=05a25038". Does the file exist?
  Plugin: vite:import-analysis
  File: /home/alichter/Programming/vitepress-rolldown-test/node_modules/.pnpm/[email protected]_@[email protected][email protected][email protected]/node_modules/vitepress/dist/client/app/data.js?v=05a25038:1:23
  1  |  import siteData from '@siteData';
     |                        ^
  2  |  import { useDark, usePreferredDark } from '@vueuse/core';
  3  |  import { computed, inject, readonly, ref, shallowRef, watch } from 'vue';
2:06:16 PM [vitepress] (client) Pre-transform error: Failed to resolve import "@siteData" from "node_modules/.pnpm/[email protected]_@[email protected][email protected][email protected]/node_modules/vitepress/dist/client/app/data.js?v=05a25038". Does the file exist?
  Plugin: vite:import-analysis
  File: /home/alichter/Programming/vitepress-rolldown-test/node_modules/.pnpm/[email protected]_@[email protected][email protected][email protected]/node_modules/vitepress/dist/client/app/data.js?v=05a25038:1:23
  1  |  import siteData from '@siteData';
     |                        ^
  2  |  import { useDark, usePreferredDark } from '@vueuse/core';
  3  |  import { computed, inject, readonly, ref, shallowRef, watch } from 'vue'; (x2)
2:06:16 PM [vitepress] (client) Pre-transform error: Failed to resolve import "@siteData" from "node_modules/.pnpm/[email protected]_@[email protected][email protected][email protected]/node_modules/vitepress/dist/client/app/data.js?v=05a25038". Does the file exist?
  Plugin: vite:import-analysis
  File: /home/alichter/Programming/vitepress-rolldown-test/node_modules/.pnpm/[email protected]_@[email protected][email protected][email protected]/node_modules/vitepress/dist/client/app/data.js?v=05a25038:1:23
  1  |  import siteData from '@siteData';
     |                        ^
  2  |  import { useDark, usePreferredDark } from '@vueuse/core';
  3  |  import { computed, inject, readonly, ref, shallowRef, watch } from 'vue'; (x3)
2:06:18 PM [vitepress] Pre-transform error: Failed to resolve import "@theme/index" from "node_modules/.pnpm/[email protected]_@[email protected][email protected][email protected]/node_modules/vitepress/dist/client/app/index.js?v=05a25038". Does the file exist?
  Plugin: vite:import-analysis
  File: /home/alichter/Programming/vitepress-rolldown-test/node_modules/.pnpm/[email protected]_@[email protected][email protected][email protected]/node_modules/vitepress/dist/client/app/index.js?v=05a25038:1:23
  1  |  import RawTheme from '@theme/index';
     |                        ^
  2  |  import { createApp as createClientApp, createSSRApp, defineComponent, h, onMounted, watchEffect } from 'vue';
  3  |  import { ClientOnly } from './components/ClientOnly';
2:06:18 PM [vitepress] Internal server error: Failed to resolve import "@theme/index" from "node_modules/.pnpm/[email protected]_@[email protected][email protected][email protected]/node_modules/vitepress/dist/client/app/index.js?v=05a25038". Does the file exist?
  Plugin: vite:import-analysis
  File: /home/alichter/Programming/vitepress-rolldown-test/node_modules/.pnpm/[email protected]_@[email protected][email protected][email protected]/node_modules/vitepress/dist/client/app/index.js?v=05a25038:1:23
  1  |  import RawTheme from '@theme/index';
     |                        ^
  2  |  import { createApp as createClientApp, createSSRApp, defineComponent, h, onMounted, watchEffect } from 'vue';
  3  |  import { ClientOnly } from './components/ClientOnly';
      at TransformPluginContext._formatLog (file:///home/alichter/Programming/vitepress-rolldown-test/node_modules/.pnpm/[email protected]/node_modules/rolldown-vite/dist/node/chunks/dep-fr0VqtUC.js:40297:41)
      at TransformPluginContext.error (file:///home/alichter/Programming/vitepress-rolldown-test/node_modules/.pnpm/[email protected]/node_modules/rolldown-vite/dist/node/chunks/dep-fr0VqtUC.js:40294:16)
      at normalizeUrl (file:///home/alichter/Programming/vitepress-rolldown-test/node_modules/.pnpm/[email protected]/node_modules/rolldown-vite/dist/node/chunks/dep-fr0VqtUC.js:38233:23)
      at async file:///home/alichter/Programming/vitepress-rolldown-test/node_modules/.pnpm/[email protected]/node_modules/rolldown-vite/dist/node/chunks/dep-fr0VqtUC.js:38352:37
      at async Promise.all (index 0)
      at async TransformPluginContext.transform (file:///home/alichter/Programming/vitepress-rolldown-test/node_modules/.pnpm/[email protected]/node_modules/rolldown-vite/dist/node/chunks/dep-fr0VqtUC.js:38279:7)
      at async EnvironmentPluginContainer.transform (file:///home/alichter/Programming/vitepress-rolldown-test/node_modules/.pnpm/[email protected]/node_modules/rolldown-vite/dist/node/chunks/dep-fr0VqtUC.js:40084:18)
      at async loadAndTransform (file:///home/alichter/Programming/vitepress-rolldown-test/node_modules/.pnpm/[email protected]/node_modules/rolldown-vite/dist/node/chunks/dep-fr0VqtUC.js:33509:27)
2:06:18 PM [vitepress] (client) Pre-transform error: Failed to resolve import "@siteData" from "node_modules/.pnpm/[email protected]_@[email protected][email protected][email protected]/node_modules/vitepress/dist/client/app/data.js?v=05a25038". Does the file exist?
  Plugin: vite:import-analysis
  File: /home/alichter/Programming/vitepress-rolldown-test/node_modules/.pnpm/[email protected]_@[email protected][email protected][email protected]/node_modules/vitepress/dist/client/app/data.js?v=05a25038:1:23
  1  |  import siteData from '@siteData';
     |                        ^
  2  |  import { useDark, usePreferredDark } from '@vueuse/core';
  3  |  import { computed, inject, readonly, ref, shallowRef, watch } from 'vue';
 ELIFECYCLE  Command failed with exit code 1.

Build

Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: Package subpath './server-renderer/index.mjs' is not defined by "exports" in /home/alichter/Programming/vitepress-rolldown-test/node_modules/vue/package.json imported from /home/alichter/Programming/vitepress-rolldown-test/docs/.vitepress/.temp/app.js
Full Error log (build)
 alichter@Lichter-Desktop  ~/Programming/vitepress-rolldown-test   main ±  pnpm build   

> vitepress-project@ build /home/alichter/Programming/vitepress-rolldown-test
> ROLLDOWN_OPTIONS_VALIDATION=loose vitepress build docs


  vitepress v1.6.3

The built-in minifier is still under development. Setting "minify: true" is not recommended for production use.
✓ building client + server bundles...
build error:
Package subpath './server-renderer/index.mjs' is not defined by "exports" in /home/alichter/Programming/vitepress-rolldown-test/node_modules/vue/package.json imported from /home/alichter/Programming/vitepress-rolldown-test/docs/.vitepress/.temp/app.js
Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: Package subpath './server-renderer/index.mjs' is not defined by "exports" in /home/alichter/Programming/vitepress-rolldown-test/node_modules/vue/package.json imported from /home/alichter/Programming/vitepress-rolldown-test/docs/.vitepress/.temp/app.js
    at exportsNotFound (node:internal/modules/esm/resolve:314:10)
    at packageExportsResolve (node:internal/modules/esm/resolve:661:9)
    at packageResolve (node:internal/modules/esm/resolve:774:12)
    at moduleResolve (node:internal/modules/esm/resolve:854:18)
    at defaultResolve (node:internal/modules/esm/resolve:984:11)
    at ModuleLoader.defaultResolve (node:internal/modules/esm/loader:685:12)
    at #cachedDefaultResolve (node:internal/modules/esm/loader:634:25)
    at ModuleLoader.resolve (node:internal/modules/esm/loader:617:38)
    at ModuleLoader.getModuleJobForImport (node:internal/modules/esm/loader:273:38)
    at ModuleJob._link (node:internal/modules/esm/module_job:135:49)
 ELIFECYCLE  Command failed with exit code 1.

Vue does export the subpath though (from the pkg json):

 "./server-renderer": {
      "import": {
        "types": "./server-renderer/index.d.mts",
        "default": "./server-renderer/index.mjs"
      },
      "require": {
        "types": "./server-renderer/index.d.ts",
        "default": "./server-renderer/index.js"
      }
    },

Reproduction

https://github.com/TheAlexLichter/vitepress-rolldown-test

Steps to reproduce

  1. pnpm i
  2. pnpm build or pnpm dev
  3. See error

System Info

System:
    OS: Linux 5.15 Ubuntu 20.04.6 LTS (Focal Fossa)
    CPU: (4) x64 AMD Ryzen 9 5900X 12-Core Processor
    Memory: 11.09 GB / 15.59 GB
    Container: Yes
    Shell: 5.8 - /usr/bin/zsh
  Binaries:
    Node: 22.14.0 - ~/.nvm/versions/node/v22.14.0/bin/node
    Yarn: 1.22.19 - /mnt/c/Program Files/nodejs/yarn
    npm: 10.9.2 - ~/.nvm/versions/node/v22.14.0/bin/npm
    pnpm: 10.0.0 - /mnt/c/Program Files/nodejs/pnpm
    bun: 1.1.16 - ~/.bun/bin/bun

Used Package Manager

pnpm

Validations

@TheAlexLichter TheAlexLichter changed the title Vitepress and rolldown-vite throw error when enabling native plugin. Vitepress and rolldown-vite throw error when enabling native plugin Apr 2, 2025
@sapphi-red
Copy link
Member

sapphi-red commented Apr 3, 2025

The current status of native plugins are:

@kcmeven
Copy link

kcmeven commented Apr 23, 2025

[MISSING_EXPORT] Error: "default" is not exported by "node_modules/.pnpm/[email protected]/node_modules/roughjs/bundled/rough.js".
╭─[ node_modules/.pnpm/@VisActor[email protected]/node_modules/@visactor/vrender-kits/es/render/contributions/rough/rough-arc.js:15:8 ]
│15 │ import rough from "roughjs";
│ ──┬──
│ ╰──── Missing export
────╯

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feat: native plugins related to exprimental.enableNativePlugins
Projects
None yet
Development

No branches or pull requests

4 participants