-
-
Notifications
You must be signed in to change notification settings - Fork 34
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: cannot apply git-changelog plugin #66
Comments
@g-dx Ah yes. Sorry about the lack of documentations here. I will try to complete the documentations ASAP this weekend. You've completed the steps to install the UI components, congrats! Than you need a vite.config.ts or vite option in config property of vitepress, to configure these two Vite plugins to read, prepare the git log data for components to render with, as well as transforming the Markdown file with the two new additional sections: integrations/docs/vite.config.ts Lines 11 to 35 in 08c4e47
Don't forget to include the stylesheets as well:
Btw, nice and such detailed issue description! Thank you for writing all these down for us to better understand the situation! |
Hi @nekomeowww Thanks for your detailed response (my apologies as I did configure I've created a reproduction of this issue over on StackBlitz here: https://stackblitz.com/edit/vite-2g78w6 You can see the site doesn't load as StackBlitz is unable to resolve the dependencies: I see the same thing in my IDE. |
Thanks for the detailed updates! Nice reproduction. Good newsThe good news is the Both VitePress, Nolebase and Nolebase Integrations uses Vite to bundle and transform the files. Vite depends on esbuild and rollup, which are bundlers too. Therefore, in order to make everything work as expected and be able to import the subdirectory contained modules, we need to tweak the default behavior of TypeScript by configuring So simply create a {
"compilerOptions": {
"target": "ESNext",
"jsx": "preserve", // Can be deleted if you don't write any JSX, TSX components, and won't import any
"lib": ["DOM", "ESNext"], // Since this is a website, should have DOM types and contexts.
"baseUrl": ".",
"module": "ESNext", // This line must be changed to "ESNext"
"moduleResolution": "Bundler", // This line must be changed to "Bundler"
"resolveJsonModule": true, // Can be deleted if you don't have JSON modules
"types": ["vite/client"], // Vite related types
"allowJs": true, // The vitepress lives in node_modules contains `.js` files, you probably need this.
"strict": true, // More strict rules
"strictNullChecks": true, // Check for nulls
"noUnusedLocals": true, // Check for unused
"esModuleInterop": true, // Help you transform es modules
"forceConsistentCasingInFileNames": true, // Can be deleted, just some casing enforcements
"isolatedModules": true, // Required by "Bundler"
"skipLibCheck": true // Skip type checks in `node_modules`
},
"include": [
// Hidden directories are omiited by default, must include explicitly
"docs/.vitepress/**/*.ts",
"docs/.vitepress/**/*.tsx",
"docs/.vitepress/**/*.vue"
]
} If you don't have npm install typescript -D yarn add typescript -D pnpm i typescript -D Bad newsProblem 1I found an undocumented vitepress behavior when it comes to declare plugins within vitepress's This is easy to get it fixed now by upgrading plugins to latest versions. But still, it is recommended to have a dedicated To do this, install vite first: npm install vite -D yarn add vite -D pnpm i vite -D And then create a dedicated import { defineConfig } from 'vite'
import { GitChangelog, GitChangelogMarkdownSection } from '@nolebase/vitepress-plugin-git-changelog/vite'
export default defineConfig(async () => {
return {
assetsInclude: ['**/*.mov', '**/*.mp4'],
plugins: [
GitChangelog(),
GitChangelogMarkdownSection(),
],
}
}) Problem 2Since Therefore, it is quite awkward to say, it is now impossible to demo and run the However, I tweaked the code a little bit to make it possible to resolve the virtual modules with a fake Anyway, no worries, I have modified the provided StackBlitz repo by you with the working version and the issues a mentioned resolved: https://stackblitz.com/edit/vite-bbvtbq?file=docs%2F.vitepress%2Fconfig.ts Feel free to ask if you encountered further problems when setting up. (We should also consider these problems within documentations as the troubleshooting section) |
Closed due to stale. You are welcomed to open it again if you have any further questions. |
Hey, thanks again for your response & apologies for my delay in responding. I updated my code to use v1.19.0 of the Git changelog plugin and can confirm everything now renders correctly 🎉 However, if I apply the suggested Thanks again for the awesome set of Vitepress plugins ⭐ |
First, thanks for producing some amazing plugins for Vitepress 🎉
I'm trying to use v1.18.0 of the Git Changelog Plugin but Vite seems unable to process it.
Given the following:
package.json
.vitepress/theme/index.ts
index.md
# Helloworld!
I get the following when attempting to run
npm docs:build
When running
npm docs:dev
I get the following error:Am I missing some configuration somewhere?
The text was updated successfully, but these errors were encountered: