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

In the CMS configuration, the defined alias cannot be recognized #4489

Closed
4 tasks done
jiazengp opened this issue Jan 12, 2025 · 1 comment
Closed
4 tasks done

In the CMS configuration, the defined alias cannot be recognized #4489

jiazengp opened this issue Jan 12, 2025 · 1 comment
Labels
bug: pending triage Maybe a bug, waiting for confirmation

Comments

@jiazengp
Copy link

jiazengp commented Jan 12, 2025

Describe the bug

I configured alias and paths in both Vite and tsconfig, and they work fine in the browser and editor. But, when setting the data loader for the CMS, alias cannot be recognized correctly.

Error info

Failed to load D:/Code/ky/docs/src/zh/blog/[post].paths.ts:
Cannot find package '@/apis' imported from D:\Code\ky\docs\src\zh\blog\[post].paths.ts.timestamp-1736689356611-ce7eef3f0d92.mjs
Error [ERR_MODULE_NOT_FOUND]: Cannot find package '@/apis' imported from D:\Code\ky\docs\src\zh\blog\[post].paths.ts.timestamp-1736689356611-ce7eef3f0d92.mjs
    at packageResolve (node:internal/modules/esm/resolve:853:9)
    at moduleResolve (node:internal/modules/esm/resolve:910:20)
    at defaultResolve (node:internal/modules/esm/resolve:1130:11)
    at ModuleLoader.defaultResolve (node:internal/modules/esm/loader:396:12)
    at ModuleLoader.resolve (node:internal/modules/esm/loader:365:25)
    at ModuleLoader.getModuleJob (node:internal/modules/esm/loader:240:38)
    at ModuleWrap.<anonymous> (node:internal/modules/esm/module_job:85:39)
    at link (node:internal/modules/esm/module_job:84:36)

Reproduction

https://stackblitz.com/edit/vite-jkcw9xpt?file=docs%2Fblog%2F%5Bid%5D.paths.ts

Expected behavior

The files are successfully imported

System Info

System:
    OS: Windows 11 10.0.22631
    CPU: (6) x64 AMD Ryzen 5 4500U with Radeon Graphics
    Memory: 964.80 MB / 15.37 GB
  Binaries:
    Node: 20.11.0 - D:\Program Files\Nodejs\node.EXE
    npm: 9.6.1 - D:\Program Files\Nodejs\npm.CMD
    pnpm: 9.15.2 - D:\Code\ky\docs\node_modules\.bin\pnpm.CMD
  Browsers:
    Edge: Chromium (129.0.2792.89)
    Internet Explorer: 11.0.22621.3527
  npmPackages:
    vitepress: 1.5.0 => 1.5.0

Additional context

No response

Validations

@jiazengp jiazengp added the bug: pending triage Maybe a bug, waiting for confirmation label Jan 12, 2025
@brc-dd
Copy link
Member

brc-dd commented Jan 12, 2025

Duplicate of #3125

@brc-dd brc-dd marked this as a duplicate of #3125 Jan 12, 2025
@brc-dd brc-dd closed this as completed Jan 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug: pending triage Maybe a bug, waiting for confirmation
Projects
None yet
Development

No branches or pull requests

2 participants