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

docs/.vitepress >> custom base path & root #34

Closed
bx-shef opened this issue Sep 13, 2024 · 4 comments · Fixed by #35
Closed

docs/.vitepress >> custom base path & root #34

bx-shef opened this issue Sep 13, 2024 · 4 comments · Fixed by #35
Labels
bug Something isn't working

Comments

@bx-shef
Copy link
Contributor

bx-shef commented Sep 13, 2024

Hello.

Project Structure
error-whyframe

The documentation is created using VitePress and is located in the /docs folder.

The project documentation will be published at https://demo.com/my-demo-folder/
In other words, the path is built relative to the '/my-demo-folder/' folder.

Config docs/.vitepress/config.mts

import {defineConfig} from 'vitepress'
import { whyframe } from '@whyframe/core'
import { whyframeVue } from '@whyframe/vue'

export default defineConfig({
  base: '/my-demo-folder/',
  vite: {
    plugins: [
      whyframe({
        defaultSrc: '/my-demo-folder/frames/default'
      }),
      whyframeVue({
        include: /\.(?:vue|md)$/
      })
    ]
  }
})

With this configuration, there is an issue
error-whyframe-2

If you build the project and view it, everything works
error-whyframe-3

The essence of the problem is in this code
error-whyframe-fix

With this approach, it will work
error-whyframe-4

@bluwy
Copy link
Owner

bluwy commented Sep 13, 2024

Amazing repro and description! That makes sense to me. So we need to prepend the base here:

attrs.push({
type: 'static',
name: isComponent ? '_why?.id' : 'data-why-id',
value: `/@id/__${entryId}`
})

And I think we can borrow the base from the Vite config using the configResolved hook in the same file, where c.base exposes it. That should fix it.

Would you like to send a PR? I'm able to fix this later too if not.

@bluwy bluwy added the bug Something isn't working label Sep 13, 2024
@bx-shef
Copy link
Contributor Author

bx-shef commented Sep 14, 2024

I'm sorry, but I can't do it in the near future

bx-shef added a commit to bx-shef/whyframe that referenced this issue Dec 1, 2024
@bx-shef
Copy link
Contributor Author

bx-shef commented Dec 1, 2024

Ok. I add PR #35

@bluwy
Copy link
Owner

bluwy commented Dec 4, 2024

Thanks for fixing it. I actually did locally but found some other issues that made base not working (and then forgotten to follow up), but anyways it's probably good enough to get some fixes out first. I'll merge your PR and cut a release.

@bluwy bluwy closed this as completed in #35 Dec 4, 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

Successfully merging a pull request may close this issue.

2 participants