Skip to content

Commit

Permalink
fix: do not exclude node_modules components
Browse files Browse the repository at this point in the history
  • Loading branch information
YunYouJun committed Dec 17, 2024
1 parent 55717ff commit b26c648
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 5 deletions.
7 changes: 5 additions & 2 deletions docs/pages/guide/custom/components.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,12 @@ This also means that you can cover one component of the theme to achieve customi
import { defineValaxyConfig } from 'valaxy'

export default defineValaxyConfig({
// @see https://github.com/unplugin/unplugin-vue-components#configuration
/**
* @see https://github.com/unplugin/unplugin-vue-components#configuration
* `/[\\/]node_modules[\\/]/, ` 不要排除 node_modules/valaxy/client/components 下的组件
*/
components: {
exclude: [/[\\/]node_modules[\\/]/, /[\\/]\.git[\\/]/, /[\\/]\.exclude[\\/]/],
exclude: [/[\\/]\.git[\\/]/, /[\\/]\.exclude[\\/]/],
},
})
```
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
"e2e": "playwright test",
"e2e:ui": "playwright test --ui",
"e2e:report": "playwright show-report",
"link:dev": "pnpm -C packages/valaxy link --global",
"lint": "eslint .",
"stylelint": "stylelint --fix \"**/*.{scss,vue}\"",
"preinstall": "npx only-allow pnpm",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export function injectPageDataCode(pageData: PageData) {
}

export function createTransformMarkdown(options: ResolvedValaxyOptions) {
const loaderVuePath = path.resolve(options.clientRoot, 'templates/loader.vue')
const loaderVuePath = path.resolve(options.clientRoot, 'templates', 'loader.vue')
const loaderVue = fs.readFileSync(loaderVuePath, 'utf-8')

return (code: string, id: string, pageData: PageData) => {
Expand Down
3 changes: 2 additions & 1 deletion packages/valaxy/node/plugins/preset.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,9 @@ export async function ViteValaxyPlugins(
include: [/\.vue$/, /\.vue\?vue/, /\.md$/],
/**
* 默认排除 components/.exclude
* `/[\\/]node_modules[\\/]/, ` 不要排除 node_modules/valaxy/client/components 下的组件
*/
exclude: [/[\\/]node_modules[\\/]/, /[\\/]\.git[\\/]/, /[\\/]\.exclude[\\/]/],
exclude: [/[\\/]\.git[\\/]/, /[\\/]\.exclude[\\/]/],

// allow override
allowOverrides: true,
Expand Down
2 changes: 1 addition & 1 deletion packages/valaxy/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "valaxy",
"type": "module",
"version": "0.22.1",
"version": "0.22.2-beta.5",
"description": "📄 Vite & Vue powered static blog generator.",
"author": {
"email": "[email protected]",
Expand Down

0 comments on commit b26c648

Please sign in to comment.