Skip to content
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

Rollup failed to resolve import "vue/server-renderer" #3035

Open
4 tasks done
shellscape opened this issue Sep 30, 2023 · 11 comments
Open
4 tasks done

Rollup failed to resolve import "vue/server-renderer" #3035

shellscape opened this issue Sep 30, 2023 · 11 comments
Labels
bug Something isn't working

Comments

@shellscape
Copy link

shellscape commented Sep 30, 2023

Describe the bug

Just as reported with #2713, I'm running into an error of: Rollup failed to resolve import "vue/server-renderer". The error happens during execution of vitepress build and apparently only on CI.

Reproduction

Link to the failing workflow: https://github.com/shellscape/jsx-email/actions/runs/6365095364/job/17281850884#step:12:104
Link to the site's source: https://github.com/shellscape/jsx-email/tree/main/apps/web.
Link to the workflow: https://github.com/shellscape/jsx-email/blob/main/.github/workflows/release.yml

To reiterate: This does not happen locally on my Mac M2 Ventura, it only occurs in CI

Expected behavior

I would have expected no build error. This looks like an environment specific issue.

System Info

System information can be viewed in the failing workflow here: https://github.com/shellscape/jsx-email/actions/runs/6365095364/job/17281850884#step:1:3

  Ubuntu
  22.04.3
  LTS
  "vitepress": "1.0.0-rc.17"
  node v20.8.0
  pnpm 8.7.1
  moon 1.12.1

Additional context

No response

Validations

Update: npm info virepress version must have been cached or something on my end because it was resolving rc17 earlier. looked it up manually and updated to vitepress v1.0.0-rc.20 and no difference on CI. Failing workflow with rc20 can be viewed here: https://github.com/shellscape/jsx-email/actions/runs/6365219441/job/17282058140#step:12:101

@shellscape shellscape added the bug: pending triage Maybe a bug, waiting for confirmation label Sep 30, 2023
@shellscape
Copy link
Author

This looks like it's related to #2187

@brc-dd
Copy link
Member

brc-dd commented Oct 22, 2023

I tried forking your repo but can't get the actions running. moon was panicking. Most likely you're hitting a weird edge case. I am seeing similar issues on Nuxt side too. Can you try something along the lines of:

// .vitepress/config.ts

vite: {
  resolve: {
    alias: {
      'vue/server-renderer': require.resolve('vue/server-renderer/index.mjs'),
    }
  }
}

@shellscape
Copy link
Author

@brc-dd will be giving that solution a try tomorrow

@boyum
Copy link

boyum commented Dec 26, 2024

Getting this error in CI, but not locally. Could it be tied to npm workspaces?
https://github.com/boyum/markdown-it-image-size/actions/runs/12507013970/job/34892868454?pr=762

Locally running on Mac M1.

@brc-dd
Copy link
Member

brc-dd commented Dec 26, 2024

@boyum Can you check if the above workaround works? 👀

@boyum
Copy link

boyum commented Dec 26, 2024

Thanks for the quick response! The above (using import.meta.resolve) breaks the build locally, but I haven't yet tried in CI.

@boyum
Copy link

boyum commented Dec 26, 2024

vite: {
  resolve: {
    alias: {
      "vue/server-renderer": import.meta.resolve(
        "vue/server-renderer/index.mjs",
      ),
    },
  },
}

produces:

vitepress-demo:build:   vitepress v1.5.0
vitepress-demo:build: 
vitepress-demo:build: failed to load config from /Users/.../markdown-it-image-size/demo/vitepress/.vitepress/config.mts
vitepress-demo:build: build error:
vitepress-demo:build: Package subpath './server-renderer/index.mjs' is not defined by "exports" in /Users/.../markdown-it-image-size/node_modules/vue/package.json imported from /Users/.../markdown-it-image-size/demo/vitepress/.vitepress/config.mts.timestamp-1735241377949-e5e62f8420f77.mjs
vitepress-demo:build: Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: Package subpath './server-renderer/index.mjs' is not defined by "exports" in /Users/.../markdown-it-image-size/node_modules/vue/package.json imported from /Users/.../markdown-it-image-size/demo/vitepress/.vitepress/config.mts.timestamp-1735241377949-e5e62f8420f77.mjs
vitepress-demo:build:     at exportsNotFound (node:internal/modules/esm/resolve:314:10)
vitepress-demo:build:     at packageExportsResolve (node:internal/modules/esm/resolve:662:9)
vitepress-demo:build:     at packageResolve (node:internal/modules/esm/resolve:842:14)
vitepress-demo:build:     at moduleResolve (node:internal/modules/esm/resolve:926:18)
vitepress-demo:build:     at defaultResolve (node:internal/modules/esm/resolve:1056:11)
vitepress-demo:build:     at ModuleLoader.defaultResolve (node:internal/modules/esm/loader:654:12)
vitepress-demo:build:     at #cachedDefaultResolve (node:internal/modules/esm/loader:603:25)
vitepress-demo:build:     at #resolveAndMaybeBlockOnLoaderThread (node:internal/modules/esm/loader:619:38)
vitepress-demo:build:     at ModuleLoader.resolveSync (node:internal/modules/esm/loader:636:52)
vitepress-demo:build:     at Object.resolve (node:internal/modules/esm/initialize_import_meta:33:25)

@boyum
Copy link

boyum commented Dec 26, 2024

vite: {
  resolve: {
    alias: {
      "vue/server-renderer": import.meta.resolve(
        "vue/server-renderer",
      ),
    },
  },
}

produces:

vitepress-demo:build:   vitepress v1.5.0
vitepress-demo:build: 
vitepress-demo:build: (node:59748) [DEP0040] DeprecationWarning: The `punycode` module is deprecated. Please use a userland alternative instead.
vitepress-demo:build: (Use `node --trace-deprecation ...` to show where the warning was created)
⠹ building client + server bundles...(node:59756) [DEP0040] DeprecationWarning: The `punycode` module is deprecated. Please use a userland alternative instead.
vitepress-demo:build: (Use `node --trace-deprecation ...` to show where the warning was created)
x Build failed in 9ms
✖ building client + server bundles...
vitepress-demo:build: build error:
vitepress-demo:build: [vite:load-fallback] Could not load file:///Users/.../markdown-it-image-size/node_modules/vue/server-renderer/index.mjs (imported by index.md): ENOENT: no such file or directory, open 'file:///Users/.../markdown-it-image-size/node_modules/vue/server-renderer/index.mjs'
vitepress-demo:build: [vite:load-fallback] Could not load file:///Users/.../markdown-it-image-size/node_modules/vue/server-renderer/index.mjs (imported by index.md): ENOENT: no such file or directory, open 'file:///Users/.../markdown-it-image-size/node_modules/vue/server-renderer/index.mjs'
vitepress-demo:build:     at async open (node:internal/fs/promises:638:25)
vitepress-demo:build:     at async Object.readFile (node:internal/fs/promises:1238:14)
vitepress-demo:build:     at async Object.load (file:///Users/.../markdown-it-image-size/node_modules/vite/dist/node/chunks/dep-CB_7IfJ-.js:65091:25)
vitepress-demo:build:     at async PluginDriver.hookFirstAndGetPlugin (file:///Users/.../markdown-it-image-size/node_modules/rollup/dist/es/shared/node-entry.js:20774:28)
vitepress-demo:build:     at async file:///Users/.../markdown-it-image-size/node_modules/rollup/dist/es/shared/node-entry.js:19894:33
vitepress-demo:build:     at async Queue.work (file:///Users/.../markdown-it-image-size/node_modules/rollup/dist/es/shared/node-entry.js:20984:32)

markdown-it-image-size/node_modules/vue/server-renderer/index.mjs definitely exists :/

@boyum
Copy link

boyum commented Dec 26, 2024

@brc-dd
Copy link
Member

brc-dd commented Dec 26, 2024

Hmm. I've got no idea then. It most likely has something to do with turbo in your case.

@boyum
Copy link

boyum commented Dec 26, 2024

I wonder if it has something to do with the Mx processors and how npm installs packages? I made it work by copying a previous package-lock file and doing a new install. boyum/markdown-it-image-size@7bba314

@brc-dd brc-dd added bug Something isn't working and removed bug: pending triage Maybe a bug, waiting for confirmation stale labels Dec 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants