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

[Bug report] - Failed to resolve import "@theme/components/Home.vue" #1427

Closed
champsupertramp opened this issue Oct 25, 2023 · 1 comment
Closed

Comments

@champsupertramp
Copy link

champsupertramp commented Oct 25, 2023

Description

I tried following the exact codes for adding content to slots:
https://vuepress.github.io/reference/default-theme/extending.html#layout-slots

I'm getting the following error:

[plugin:vite:import-analysis] Failed to resolve import "@theme/components/Home.vue" from "node_modules/@vuepress/theme-default/layouts/Layout.vue". Does the file exist?
/Users/champcamba/Code/wordpress/ultimatemember/docs-v3/node_modules/@vuepress/theme-default/layouts/Layout.vue:47:19
1  |  
2  |  import Home from '@theme/components/Home.vue'
   |                    ^
3  |  import Navbar from '@theme/components/Navbar.vue'
4  |  import Page from '@theme/components/Page.vue'

And my workaround is adding the aliases in config.js:

    alias: {
      '@theme/HomeFooter.vue': fs_path.resolve(__dirname, './components/UMHomeFooter.vue'),
      '@theme/PageEdit.vue': fs_path.resolve(__dirname, './components/UMPageEdit.vue'),
      '@theme/components/Home.vue': '@vuepress/theme-default/components/Home.vue',
      '@theme/components/Navbar.vue': '@vuepress/theme-default/components/Navbar.vue',
      '@theme/components/Page.vue': '@vuepress/theme-default/components/Page.vue',
      '@theme/components/Sidebar.vue': '@vuepress/theme-default/components/Sidebar.vue',
      '@theme/components/SidebarLink.vue': '@vuepress/theme-default/components/SidebarLink.vue',
      '@theme/components/SidebarLinks.vue': '@vuepress/theme-default/components/SidebarLinks.vue',
      '@theme/components/NavLinks.vue':  fs_path.resolve(__dirname, './components/NavLinks.vue'),
      '@theme/components/NavLink.vue': '@vuepress/theme-default/components/NavLink.vue',
      '@theme/components/DropdownLink.vue': '@vuepress/theme-default/components/DropdownLink.vue',
      '@theme/components/DropdownTransition.vue': '@vuepress/theme-default/components/DropdownTransition.vue',
      '@theme/components/SidebarGroup.vue': '@vuepress/theme-default/components/SidebarGroup.vue',
      '~@theme/styles/config.styl': '@vuepress/theme-default/styles/config.styl',
  
    },

Reproduction

I couldn't reproduce this issue on the playground site

Used Package Manager

pnpm

System Info

System:
    OS: macOS 13.3.1
    CPU: (12) arm64 Apple M2 Pro
    Memory: 1.26 GB / 16.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 18.16.0 - ~/.nvm/versions/node/v18.16.0/bin/node
    Yarn: Not Found
    npm: 9.8.0 - ~/.nvm/versions/node/v18.16.0/bin/npm
  Utilities:
    Git: 2.39.2 - /usr/bin/git
  Browsers:
    Chrome: 118.0.5993.88
    Edge: Not Found
    Safari: 16.4
  npmPackages:
    @vuepress/bundler-vite:  2.0.0-beta.67 
    @vuepress/bundler-webpack: 2.0.0-beta.45 => 2.0.0-beta.45 
    @vuepress/cli: 2.0.0-beta.45 => 2.0.0-beta.45 (2.0.0-beta.67)
    @vuepress/client: 2.0.0-beta.67 => 2.0.0-beta.67 (2.0.0-beta.45)
    @vuepress/core:  2.0.0-beta.45 (2.0.0-beta.67)
    @vuepress/markdown:  2.0.0-beta.45 (2.0.0-beta.67)
    @vuepress/plugin-active-header-links: 2.0.0-beta.67 => 2.0.0-beta.67 (1.9.10)
    @vuepress/plugin-back-to-top: 2.0.0-beta.67 => 2.0.0-beta.67 
    @vuepress/plugin-container:  2.0.0-beta.67 
    @vuepress/plugin-docsearch: Not Found
    @vuepress/plugin-external-link-icon:  2.0.0-beta.67 
    @vuepress/plugin-git:  2.0.0-beta.67 
    @vuepress/plugin-google-analytics: ^1.9.10 => 1.9.10 
    @vuepress/plugin-medium-zoom: 2.0.0-beta.67 => 2.0.0-beta.67 
    @vuepress/plugin-nprogress: 2.0.0-beta.67 => 2.0.0-beta.67 (1.9.10)
    @vuepress/plugin-palette: 2.0.0-beta.67 => 2.0.0-beta.67 
    @vuepress/plugin-prismjs: 2.0.0-beta.67 => 2.0.0-beta.67 
    @vuepress/plugin-pwa: Not Found
    @vuepress/plugin-pwa-popup: Not Found
    @vuepress/plugin-register-components: 2.0.0-beta.67 => 2.0.0-beta.67 
    @vuepress/plugin-search: 2.0.0-beta.67 => 2.0.0-beta.67 (1.9.10)
    @vuepress/plugin-shiki: Not Found
    @vuepress/plugin-theme-data:  2.0.0-beta.67 
    @vuepress/plugin-toc: Not Found
    @vuepress/shared:  2.0.0-beta.45 (2.0.0-beta.67, 2.0.0-alpha.1)
    @vuepress/theme-default: ^1.9.10 => 1.9.10 (2.0.0-beta.67)
    @vuepress/utils: 2.0.0-alpha.1 => 2.0.0-alpha.1 (2.0.0-beta.67, 2.0.0-beta.45)
    vue: ^3.3.7 => 3.3.7 
    vue-loader:  17.3.0 
    vue-router:  4.2.5 
    vuepress: 2.0.0-beta.67 => 2.0.0-beta.67 
    vuepress-vite:  2.0.0-beta.67 
    vuepress-webpack: Not Found
@meteorlxy
Copy link
Member

meteorlxy commented Nov 2, 2023

Some packages you are using are outdated / for v1. Please make sure all vuepress-related packages are using the latest version.

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants