vuejs / vitepress

Vite & Vue powered static site generator.
https://vitepress.dev
MIT License
12.83k stars 2.07k forks source link

ThemeConfig is ignored when using vite.config.ts inside docs #373

Closed alvarosabu closed 3 years ago

alvarosabu commented 3 years ago

Describe the bug

Hello, awesome effort, looking forward to how this project grows.

Context: adding documentation with Vitepress to a vue3 library that uses aliases inside /@.

Added resolve.alias using a vite.config.ts based on this https://github.com/vuejs/vitepress/issues/241

It worked, but suddenly ignored completely the config on docs/.vitepress/config.ts (title, sidebar, nav, etc)

// docs/.vitepress/config.ts

module.exports = {
  title: 'Vue Dynamic Forms',
  description,
  themeConfig: {
    repo: 'asigloo/vue-dynamic-forms',
    logo: '/logo.svg',
    nav: [
      {
        text: 'Migration Guide',
        link: '/v3/guide/migration-guide',
      },
    ],
    sidebar: {
      '/': [
        {
          text: 'Guide',
          children: [
            {
              text: 'Introduction',
              link: '/guide/',
            },
            {
              text: 'Getting Started',
              link: '/guide/getting-started',
            },
            {
              text: 'Usage',
              link: '/guide/usage',
            },
          ],
        },
      ],
    },
  },
}

Screenshot 2021-08-24 at 13 49 07

Reproduction

Expected behavior

vite.config.ts docs/.vitepress/config.ts configs can live together

or

An option to add alias to docs/.vitepress/config.ts

System Info

System:
    OS: macOS 11.4
    CPU: (16) x64 Intel(R) Core(TM) i9-9980HK CPU @ 2.40GHz
    Memory: 544.29 MB / 16.00 GB
    Shell: 5.8 - /bin/zsh
  Binaries:
    Node: 16.3.0 - ~/.nvm/versions/node/v16.3.0/bin/node
    Yarn: 1.22.10 - /usr/local/bin/yarn
    npm: 7.19.1 - ~/Projects/github/vue-dynamic-forms/node_modules/.bin/npm
  Browsers:
    Chrome: 92.0.4515.159
    Firefox: 89.0.1
    Safari: 14.1.1
  npmPackages:
    vitepress: ^0.16.1 => 0.15.6 


### Additional context

_No response_

### Validations

- [X] Follow our [Code of Conduct](https://vuejs.org/coc)
- [X] Read the [docs](https://vitepress.vuejs.org/).
- [X] Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
userquin commented 3 years ago

@alvarosaburido can you try adding this entry on yourvite.config.ts file?:

   server: {
    hmr: {
      overlay: false,
    },
  }
alvarosabu commented 3 years ago

Hi @userquin thanks for answering, I just tried but the same result unfortunately

userquin commented 3 years ago

compare your repo with pwa repo docs package or vueuse repo, we have not this problem, maybe you need to include your own theme

alvarosabu commented 3 years ago

Basically, @userquin the difference is that on vueuse repo you have a really customized theme, it doesn't work with the default one.

Wouldn't make sense to allow adding aliases on the .vitepress/config directly?

userquin commented 3 years ago

@alvarosaburido is your repo public?

alvarosabu commented 3 years ago

@userquin I just realized the cause of my issue, I renamed .vitepress/config.ts to a js file .vitepress/config.js and now it works as expected.

I will close the issue if it's ok for you. Thanks a lot for the support

kasvith commented 2 years ago
server: {
    hmr: {
      overlay: false,
    },
  }

This helped me solving the issue