vuepress / core Goto Github PK
View Code? Open in Web Editor NEWVue-Powered Static Site Generator
Home Page: https://vuepress.vuejs.org
License: MIT License
Vue-Powered Static Site Generator
Home Page: https://vuepress.vuejs.org
License: MIT License
medium-zoom Plugin isn't functional if base
in config.ts is set to a sub path like base: '/bar/'
.
base: '/bar/'
in config.ts.![myimage](/images/myimage.jpg)
→ image doesn't display, as expected.![myimage](/bar/images/myimage.jpg)
→ image displays and medium-zoom is functional, but we have 'hardcoded' the relative path.<img :src="$withBase('/images/myimage.jpg')" alt="">
→ image displays but medium-zoom is not functional, that's the issue.medium-zoom Plugin should be functional together with $withBase, means when clicking on image with option iii above the image should be zoomed.
It seems that the base
config setting isn't being propagated to "internal" links, leading to incorrect links.
In my config, I have set the base config: base: "/fixture-riveter/"
. Then in the docs folder, in /api/README.md
, I have written [fr](/api/fr/)
to link to /api/fr/README.md
. The generated incorrect link (with svg elided for readability) is:
<a href="/api/fr/" target="_blank" rel="noopener noreferrer">fr api<span><svg ...></svg><span class="sr-only">open in new window</span></span></a>
When working locally, if I remove the base
setting, the link is now the correct <a href="/api/fr/" class="">fr api</a>
. But this doesn't work when I push to my github pages, obviously.
The incorrect link can be seen here.
Links are generated correctly.
vuepress info
:$ npx vuepress info
System:
OS: macOS Mojave 10.14.6
CPU: (12) x64 Intel(R) Core(TM) i9-8950HK CPU @ 2.90GHz
Memory: 2.02 GB / 32.00 GB
Shell: 5.0.17 - /usr/local/bin/bash
Binaries:
Node: 12.13.0 - ~/.nodenv/versions/12.13.0/bin/node
Yarn: Not Found
npm: 7.5.3 - ~/.nodenv/versions/12.13.0/bin/npm
Utilities:
Git: 2.29.1 - /usr/local/bin/git
Browsers:
Chrome: 88.0.4324.150
Edge: Not Found
Firefox: 85.0.1
Safari: 13.1
npmPackages:
@vuepress/bundler-webpack: 2.0.0-alpha.20
@vuepress/cli: undefined (2.0.0-alpha.20)
@vuepress/client: 2.0.0-alpha.20
@vuepress/core: 2.0.0-alpha.20
@vuepress/markdown: 2.0.0-alpha.20
@vuepress/plugin-active-header-links: 2.0.0-alpha.20
@vuepress/plugin-back-to-top: 2.0.0-alpha.20
@vuepress/plugin-container: 2.0.0-alpha.20
@vuepress/plugin-debug: Not Found
@vuepress/plugin-docsearch: Not Found
@vuepress/plugin-git: 2.0.0-alpha.21
@vuepress/plugin-google-analytics: Not Found
@vuepress/plugin-medium-zoom: 2.0.0-alpha.20
@vuepress/plugin-nprogress: 2.0.0-alpha.20
@vuepress/plugin-palette-stylus: 2.0.0-alpha.20
@vuepress/plugin-pwa: Not Found
@vuepress/plugin-pwa-popup: Not Found
@vuepress/shared: 2.0.0-alpha.20
@vuepress/theme-default: 2.0.0-alpha.21
@vuepress/theme-vue: Not Found
@vuepress/utils: 2.0.0-alpha.20
vue: 3.0.5
vue-loader: 16.1.2
vue-router: 4.0.3
vuepress: ^2.0.0-alpha.21 => 2.0.0-alpha.21
Fist of all: Could you open the dicussion board?
I DO read through your codes. And below is a other thing I wanna say towards the _variable.styl
.
The design goal of Vue SFC is to place the styles, template and script in one place. And I think there are several disadvantages for you to decouple styles and components in default theme, for just making a palette import more easily.
@theme
and @parent-theme
to let users easily overside some layouts and components while using the rest in a third-party theme (And I saw you drop it because of decouipling webpack). Decouping the styles with components means users have to think out a css selector with higher priority or use !important
to overide the styles in styles
folder when using theme extending and replace the components in default theme with theirs. While they can just write a component of them with most of the styles remain in component in V1.Again, I DO think you do not take fully understand of uliuz's work before making changes on it! 🤔
The DefaultThemeOption
is using types from plugin-docsearch
, while it is not installed by default.
So errors will be trigged if the plugin is not installed.
I tried upgrading one of my projects to vuepress-next today and unfortunately the dev server does not work on Widows. Running the same command in WSL works perfectly fine.
Version
Vuepress 2.0.0-alpha.5
Reproduce
Run yarn vuepress dev
in a Vuepress project on Windows.
Logs
$ D:\<path-to-project>\node_modules\.bin\vuepress dev
info Initializing VuePress and preparing data...
WebpackOptionsValidationError: Invalid configuration object. Webpack has been initialised using a configuration object that does not match the API schema.
- configuration.output.path: The provided value "D:/<path-to-project>/.vuepress/dist" is not an absolute path!
-> The output directory as **absolute path** (required).
at webpack (D:\<path-to-project>\node_modules\webpack\lib\webpack.js:31:9)
at Object.dev (D:\<path-to-project>\node_modules\@vuepress\bundler-webpack\lib\dev\createDev.js:29:22)
at processTicksAndRejections (internal/process/task_queues.js:93:5)
at async dev (D:\<path-to-project>\node_modules\@vuepress\cli\lib\commands\dev\dev.js:42:19)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
Navigation to anchor on another page does not work. In dev mode, the browser will receive a warning message from vue-router.
Couldn't find element using selector "#plugins" returned by scrollBehavior.
Navigation to anchor
Is there any plan to integrate vuepress blog plugin?
Either migrate vupress-plugin-blogs to vuejs v3 or integrate its feature directly into default-theme.
I'd like to ask when the beta version will be available online and finish writing the official website documents. Do the officials have a plan?
this will help manage common code snippets
When I try to use vuepress-plugin-container
, it makes an error plugin container is not found
.
Not sure if this is a proper error, or just a mistake I made.
npm i -D @vuepress/plugin-container@next && npm i -D @vuepress@next
config.js:
module.exports = {
plugins: [
[
"container",
{
type: "full",
before: (info) =>
info
? `<div class="img-full img-full-${info}">`
: '<div class="img-full">',
after: "</div>",
},
],
],
};
and then npx vuepress
-> error
No error when using vuepress-plugin-container
vuepress info
:System:
Shell: 5.1.4 - /usr/local/bin/bash
Binaries:
Node: 15.5.1 - /usr/local/bin/node
Yarn: Not Found
npm: 7.3.0 - /usr/local/bin/npm
Utilities:
Git: 2.30.0 - /usr/local/bin/git
Browsers:
Chrome: 83.0.4103.116
Edge: Not Found
Firefox: 84.0.2
Safari: 13.1.2
npmPackages:
@vuepress/bundler-webpack: 2.0.0-alpha.15
@vuepress/cli: 2.0.0-alpha.15
@vuepress/client: 2.0.0-alpha.15
@vuepress/core: 2.0.0-alpha.15
@vuepress/markdown: 2.0.0-alpha.15
@vuepress/plugin-active-header-links: 2.0.0-alpha.15
@vuepress/plugin-back-to-top: 2.0.0-alpha.15
@vuepress/plugin-container: 2.0.0-alpha.15
@vuepress/plugin-debug: 2.0.0-alpha.15
@vuepress/plugin-docsearch: Not Found
@vuepress/plugin-git: 2.0.0-alpha.15
@vuepress/plugin-google-analytics: Not Found
@vuepress/plugin-medium-zoom: 2.0.0-alpha.15
@vuepress/plugin-nprogress: 2.0.0-alpha.15
@vuepress/plugin-palette-stylus: 2.0.0-alpha.15
@vuepress/plugin-pwa: Not Found
@vuepress/plugin-pwa-popup: Not Found
@vuepress/shared: 2.0.0-alpha.15
@vuepress/theme-default: 2.0.0-alpha.15
@vuepress/theme-vue: Not Found
@vuepress/utils: 2.0.0-alpha.15
vuepress: ^2.0.0-alpha.15 => 2.0.0-alpha.15
Can the @vuepress/plugin-palette-stylus
add support for theme palette?
Currently We can only config users' palette. But it would be nice to add theme palette support to let theme provides fallback value for stylus variables. Becase some variables are using accross the theme components, and it's not graceful to import a common file at the beginning of style block or write fallbacks in every file.
I have to write like this in most of my components now:
...
<style lang="stylus">
@require '../styles/palette'
...
</style>
or
...
<style lang="stylus">
$variableName1 ?= value
$variableName2 ?= value
...
</style>
Add a theme themePaletteFile
option
Mermaid for Vuepress 2.x support
Mermaid already supports VuePress1.x, but doesn't support 2.x, I really want it to work on VuePress 2.x
Since Vuepress exposes the Router
to clients in clientAppEnhance
files, it should be safe to assume that all APIs pertaining to it should be usable, such as, adding routes on-the-fly with Router.addRoute. Vuepress does make this do-able; however, at runtime when trying to navigate to the newly added routes an unexpected error is thrown from Vuepress' custom router resolve guard due to Vuepress not registering the new routes' component as a pagesComponent
.
clientAppEnhance.js
with following body:const Custom = { template: `<div>I'm a custom component for a custom route!</div>` }
export default defineClientAppEnhance(({
app,
router,
siteData
}) => {
router.addRoute({
path: '/custom',
component: Custom
})
});
Layout.vue
, provide a RouterLink
:<RouterLink to="/custom">Custom</RouterLink>
The router reproduction was to confirm that vue-router@v4
does properly support aliases, which is my exact use case. The git repo shows that this issue is triggered regardless if it's an alias or separate path.
Vuepress shouldn't impede custom navigation.
vuepress info
:System:
OS: Linux 5.11 Fedora 33 (Workstation Edition) 33 (Workstation Edition)
CPU: (8) x64 Intel(R) Core(TM) i7-6700HQ CPU @ 2.60GHz
Memory: 21.11 GB / 31.22 GB
Shell: 5.0.17 - /bin/bash
Binaries:
Node: 14.15.1 - /tmp/yarn--1617696568327-0.479712292609096/node
Yarn: 1.22.10 - /tmp/yarn--1617696568327-0.479712292609096/yarn
npm: 7.8.0 - ~/.nvm/versions/node/v14.15.1/bin/npm
Utilities:
Git: 2.30.2 - /usr/bin/git
Browsers:
Chrome: Not Found
Firefox: 87.0
npmPackages:
@vuepress/bundler-vite: Not Found
@vuepress/bundler-webpack: 2.0.0-beta.6
@vuepress/cli: 2.0.0-beta.6
@vuepress/client: 2.0.0-beta.6
@vuepress/core: 2.0.0-beta.6
@vuepress/markdown: 2.0.0-beta.5
@vuepress/plugin-active-header-links: 2.0.0-beta.6
@vuepress/plugin-back-to-top: 2.0.0-beta.6
@vuepress/plugin-container: 2.0.0-beta.6
@vuepress/plugin-debug: Not Found
@vuepress/plugin-docsearch: Not Found
@vuepress/plugin-git: 2.0.0-beta.6
@vuepress/plugin-google-analytics: Not Found
@vuepress/plugin-medium-zoom: 2.0.0-beta.6
@vuepress/plugin-nprogress: 2.0.0-beta.6
@vuepress/plugin-palette: 2.0.0-beta.6
@vuepress/plugin-pwa: Not Found
@vuepress/plugin-pwa-popup: Not Found
@vuepress/plugin-theme-data: 2.0.0-beta.6
@vuepress/shared: 2.0.0-beta.4
@vuepress/theme-default: 2.0.0-beta.6
@vuepress/theme-vue: Not Found
@vuepress/utils: 2.0.0-beta.5
vue: 3.0.11
vue-loader: 16.2.0
vue-router: 4.0.5
vuepress: ^2.0.0-beta.6 => 2.0.0-beta.6
vuepress-vite: Not Found
The navigation bar is not underlined when a subpath is activated
the guide is not underlined in navbar
It seems like the VuePress client is using an invalid path in its URL on Windows when using the Vite bundler.
Instead of http://localhost:8080/@fs/Projects/vuepress-test/node_modules/@vuepress/client/lib/client.js
, it tries to request http://localhost:8080/@fsC:/Projects/vuepress-test/node_modules/@vuepress/client/lib/client.js
instead.
Note the C:
drive letter.
I'm not entirely sure how the whole thing works just yet, but this seems to be where things break down:
https://github.com/vuepress/vuepress-next/blob/main/packages/%40vuepress/bundler-vite/src/plugin/createPlugin.ts#L48
Replacing the line linked above with the following (possibly naïve) line makes it work as expected:
const clientEntry = app.dir.client('lib/client.js').split(':').pop()
On Windows, create a project, add the Vite bundler and run vuepress dev
.
Instead of seeing content, there's a blank screen with a 404 on the request for the VuePress client.
Apply the change listed above and restart the dev server, now the content should show up.
The URL should not include the drive letter. Presumably this is only a problem on Windows.
vuepress info
: System:
OS: Windows 10 10.0.19042
CPU: (8) x64 Intel(R) Core(TM) i7-9700K CPU @ 3.60GHz
Memory: 12.93 GB / 31.92 GB
Binaries:
Node: 14.15.4 - ~\AppData\Local\Volta\tools\image\node\14.15.4\node.EXE
Yarn: 1.22.10 - ~\AppData\Local\Volta\tools\image\yarn\1.22.10\bin\yarn.CMD
npm: 6.14.11 - ~\AppData\Local\Volta\tools\image\npm\6.14.11\bin\npm.CMD
Utilities:
Git: 2.21.0.
Browsers:
Chrome: Not Found
Edge: Spartan (44.19041.423.0), Chromium (89.0.774.54)
npmPackages:
@vuepress/bundler-webpack: 2.0.0-beta.1
@vuepress/cli: 2.0.0-beta.2
@vuepress/client: 2.0.0-beta.1
@vuepress/core: 2.0.0-beta.1
@vuepress/markdown: 2.0.0-beta.1
@vuepress/plugin-active-header-links: 2.0.0-beta.1
@vuepress/plugin-back-to-top: 2.0.0-beta.1
@vuepress/plugin-container: 2.0.0-beta.1
@vuepress/plugin-debug: Not Found
@vuepress/plugin-docsearch: Not Found
@vuepress/plugin-git: 2.0.0-beta.1
@vuepress/plugin-google-analytics: Not Found
@vuepress/plugin-medium-zoom: 2.0.0-beta.1
@vuepress/plugin-nprogress: 2.0.0-beta.2
@vuepress/plugin-palette: 2.0.0-beta.1
@vuepress/plugin-pwa: Not Found
@vuepress/plugin-pwa-popup: Not Found
@vuepress/plugin-theme-data: 2.0.0-beta.1
@vuepress/shared: 2.0.0-beta.1
@vuepress/theme-default: 2.0.0-beta.2
@vuepress/theme-vue: Not Found
@vuepress/utils: 2.0.0-beta.1
vue: 3.0.7
vue-loader: 16.1.2
vue-router: 4.0.5
vuepress: ^2.0.0-beta.2 => 2.0.0-beta.2
I want config something with global, can i use enhanceApp.ts
?
And it's work components
dir files ?
command not found: vuepress
终端进程“/bin/bash '-c', 'yarn run dev'”已终止,退出代码: 127。
vuepress info
:# Paste output of `vuepress info` here
# Unable to do so, command not found, but I am do using the latest alpha13
I would like to ship a feature to auto generating manifest to the official pwa plugin. That would add support for installing it on desktops or mobile phones as an app.
See https://vuepress-pwa.mrhope.site/guide/#manifest for description
And https://vuepress-pwa.mrhope.site/config/#manifest for fallbacks.
If you think it's a nice feature, I will ship this feature to the official plugin.
Besides, I think it would be nice if the official plugin can have some simple options configuring the service worker. ( The request came from my users)
https://vuepress-pwa.mrhope.site/guide/#cache-size
I am looking forward for your opinion towards it.
关于back-to-top插件禁用问题
plugins: [
['@vuepress/back-to-top', false]
],
此处false或者true均不管用
默认还是开启的
version: 2.0.0-alpha.1
when I init a new project and run it with vuepress dev docs
, I get this error TypeError: clientAppEnhanceFiles.flat is not a function
I would like to ask when the theme-related documents can be finished. In vuepress1.0, I can modify palette.styl to justify default style, but in vuepress-next, the palette file is removed, how to modify default style ecpect modify index.styl?
I saw V2 add a date
field in frontmatter in here:
And add a date field in page:
Theme and plugin builders may want to fetch the page date and use it.
The date can also be infered from git log, but git plugin currently support only updatedTime
and contributors
.
I think adding a new field called createTime
(first commit) would be better for theme and plugin builders to fetch the page date from git as a improvement instead of letting users fill in.
accroad to officeal Getting Started
to init the project ,and then yarn docs:dev"
can work success
vuepress info
:# Paste output of `vuepress info` here
system:
OS: macOS 11.2.3
CPU: (8) arm64 Apple M1
Memory: 84.09 MB / 16.00 GB
Shell: 5.8 - /bin/zsh
Binaries:
Node: 15.5.1 - ~/.nvm/versions/node/v15.5.1/bin/node
Yarn: 1.22.10 - ~/.nvm/versions/node/v15.5.1/bin/yarn
npm: 7.6.3 - /usr/local/bin/npm
Utilities:
Git: 2.30.2
Browsers:
Chrome: 89.0.4389.114
Edge: Not Found
Firefox: Not Found
Safari: 14.0.3
npmPackages:
@vuepress/bundler-webpack: 2.0.0-beta.1
@vuepress/cli: 2.0.0-beta.0 (2.0.0-beta.1)
@vuepress/client: 2.0.0-beta.0 (2.0.0-beta.1)
@vuepress/core: 2.0.0-beta.0 (2.0.0-beta.1)
@vuepress/markdown: 2.0.0-beta.0 (2.0.0-beta.1)
@vuepress/plugin-active-header-links: 2.0.0-beta.0 (2.0.0-beta.1)
@vuepress/plugin-back-to-top: 2.0.0-beta.0 (2.0.0-beta.1)
@vuepress/plugin-container: 2.0.0-beta.0 (2.0.0-beta.1)
@vuepress/plugin-debug: Not Found
@vuepress/plugin-docsearch: Not Found
@vuepress/plugin-git: 2.0.0-beta.0 (2.0.0-beta.1)
@vuepress/plugin-google-analytics: Not Found
@vuepress/plugin-medium-zoom: 2.0.0-beta.0 (2.0.0-beta.1)
@vuepress/plugin-nprogress: 1.8.2 (2.0.0-beta.0, 2.0.0-beta.1)
@vuepress/plugin-palette: 2.0.0-beta.0 (2.0.0-beta.1)
@vuepress/plugin-pwa: Not Found
@vuepress/plugin-pwa-popup: Not Found
@vuepress/plugin-theme-data: 2.0.0-beta.0 (2.0.0-beta.1)
@vuepress/shared: 2.0.0-beta.0 (2.0.0-beta.1)
@vuepress/theme-default: 2.0.0-beta.0 (2.0.0-beta.1)
@vuepress/theme-vue: Not Found
@vuepress/utils: 2.0.0-beta.0 (2.0.0-beta.1)
vue: 3.0.7
vue-loader: 16.1.2
vue-router: 4.0.5
vuepress: ^2.0.0-beta.1 => 2.0.0-beta.1
It's reason for
const { stdout } = await execa(
'git',
['-P', 'shortlog', '-nes', '--', filePath],
{
cwd,
stdin: 'inherit',
}
)
cause -P
?
Google Analytics 4 is a breaking version, and we'd better support it via different plugin than Google Analytics 3.
Related issue: vuejs/vuepress#2713
@vuepress/plugin-google-analytics
to @vuepress/plugin-google-analytics-3
@vuepress/plugin-google-analytics
Alternative:
@vuepress/plugin-google-analytics
with Google Analytics 4, and drop Google Analytics 3 support如下调入中文路径无效。调入英文正常。
I'm trying to create a Vuepress next site and running into a roadblock.
I can only specify a path to the local theme (<repo>/.vuepress/theme
) by using an absolute path... this poses a problem because the path to the theme is different on my machine than another developer's.
Why doesn't this work in .vuepress/config.js
?
module.exports = {
theme: '.vuepress/theme',
}
or
module.exports = {
theme: './theme',
}
when the beta version will be available online
I'd like to ask when the beta version will be available online and finish writing the official website documents.
We see in the document that this plugin only take effect in development mode, but in fact it works in any mode.
Debug
button was shown in the right-bottomDebug plugin should work only in development mode.
BTW, why not add an option: devOnly=true
None
@vuepress/[email protected]
Please support TOC on a page which fixes on the right side of the page like this:
When the browser width is greater than a certain size, such as 1200px, it shows up and there are merely the sidebar top-most items. Otherwise, it is hidden and the sidebar behaves normally according to configuration just like now.
sidebarDepth
may be used to control nav levels not included h1
head.
Cannot use '<>' to define hyperlinks
无法使用 <>
来定义超链接
vuepress info
:yarn run v1.22.5
warning package.json: No license field
$ C:\Users\Yue_plus\Desktop\test\node_modules\.bin\vuepress info
System:
OS: Windows 10 10.0.19042
CPU: (8) x64 Intel(R) Xeon(R) CPU E3-1230 V2 @ 3.30GHz
Memory: 2.85 GB / 7.91 GB
Binaries:
Node: 14.15.4 - ~\AppData\Local\Temp\yarn--1613422346753-0.7823532832627786\node.CMD
Yarn: 1.22.5 - ~\AppData\Local\Temp\yarn--1613422346753-0.7823532832627786\yarn.CMD
npm: 6.14.10 - C:\Program Files\nodejs\npm.CMD
Utilities:
Git: 2.27.0.
Browsers:
Chrome: Not Found
Edge: Spartan (44.19041.423.0), Chromium (88.0.705.68)
npmPackages:
@vuepress/bundler-webpack: 2.0.0-alpha.24
@vuepress/cli: 2.0.0-alpha.24
@vuepress/client: 2.0.0-alpha.24
@vuepress/core: 2.0.0-alpha.24
@vuepress/markdown: 2.0.0-alpha.24
@vuepress/plugin-active-header-links: 2.0.0-alpha.24
@vuepress/plugin-back-to-top: 2.0.0-alpha.24
@vuepress/plugin-container: 2.0.0-alpha.24
@vuepress/plugin-debug: Not Found
@vuepress/plugin-docsearch: Not Found
@vuepress/plugin-git: 2.0.0-alpha.24
@vuepress/plugin-google-analytics: Not Found
@vuepress/plugin-medium-zoom: 2.0.0-alpha.24
@vuepress/plugin-nprogress: 2.0.0-alpha.24
@vuepress/plugin-palette-stylus: 2.0.0-alpha.24
@vuepress/plugin-pwa: Not Found
@vuepress/plugin-pwa-popup: Not Found
@vuepress/shared: 2.0.0-alpha.24
@vuepress/theme-default: 2.0.0-alpha.24
@vuepress/theme-vue: Not Found
@vuepress/utils: 2.0.0-alpha.24
vue: 3.0.5
vue-loader: 16.1.2
vue-router: 4.0.3
vuepress: ^2.0.0-alpha.24 => 2.0.0-alpha.24
Done in 2.91s.
VuePress Team,
I just created this issue in a different repository because that repository was originally the source code for the https://vuepress.github.io/
website, but I now see that this repository is the new source code for that website.
That being said, can you please look at my ticket and see what I requested? You have removed all of the documentation for the VuePress Community plugins (for example, vuepress-plugin-container), and it would be really nice to have that documentation back ASAP.
Thanks.
Please update the default theme to be dynamic, i.e. support dark mode.
This was the best I could find:
https://github.com/tolking/vuepress-theme-default-prefers-color-scheme
as I personally believe a dynamic theme shouldn't expose any manual toggles to the user.
Badge tip与error 渲染效果一样
I am sure a few people wants muti action button support in the vuepress repo. vuejs/vuepress#2261
I am having this feature in my own theme, and I saw my users are using it.
actions:
- link: link1
text: text1
- link: link2
text: text2
I am willing to send a PR if you think it's fine.
when i make a README.md, i add
_当前计数为: {{ count }}_
<button @click="count++">点我!</button>
// next code origin from components
<basic-table />
<script lang="ts">
import { defineComponent, ref } from 'vue';
export default defineComponent({
setup() {
const msg = 'Markdown 中的 Vue';
const count = ref(0);
return {
msg,
count,
}
}
})
</script>```
when i add a sfc file from components catalog, i get a error like title,
i think my custom sfc file also has script tag,
i get two script tags from .temp/pages/README.vue;
how can i add my custom component to the md file;
[Vue warn]: Component is missing template or render function.
Original issue: vuejs/vuepress#2689
As some users were trying to use vuepress on large scale projects, there might be some scalability issues to be solved.
I'll update some concerns and testing results here.
total pages: ~2040
theme: unfinished default theme
plugins: no
dev: ~80s
build: ~200s
Navigate failed and the console output TypeError: __VUE_HMR_RUNTIME__.updatePageData is not a function
.
If I use Webpack as the bundler instead of Vite, everything will be OK.
Navigate to /post.html.
First I want to thank you all for the great job you do, and apologize in advance if my issue form is lacking anything. Its the first time I ever fill an issue on an OSS repository so I kinda have no clue what I'm doing but I did my best to fill everything up correctly.
When creating a Vue 3 application with the latest version of the Vue CLI, and adding vuepress@next
to the project, the vue components outputed by vuepress are generated from Markdown properly, but can't be compiled by webpack and served.
Install the latest version of the Vue CLI (4.5.11 on my machine)
yarn global add @vue/cli
Create a new vue 3 project
vue create my-project
Add vuepress to the project according to this documentation (starting at step 3 since we already have a vue project)
Serve the vuepress documentation
yarn docs:dev
You can find a reproduction here, this is a quick example and I used a custom Vue CLI preset I use all the time. (Basically Vue 3 with TypeScript and test)
The Vue components generated by vuepress should compile successfuly and be available on the development server.
Output of yarn docs:dev
:
$ vuepress dev docs
info Initializing VuePress and preparing data...
√ Compilation finished in 574ms
ERROR in ./node_modules/@vuepress/client/lib/components/OutboundLink.js 2:0-28
Module not found: Error: Can't resolve 'style-loader' in 'C:\Users\pierr\Documents\Code\kerunix\Bug Repros\test-version'
ERROR in ./node_modules/@vuepress/plugin-medium-zoom/lib/clientAppEnhance.js 3:0-35
Module not found: Error: Can't resolve 'style-loader' in 'C:\Users\pierr\Documents\Code\kerunix\Bug Repros\test-version'
ERROR in ./node_modules/@vuepress/plugin-nprogress/lib/clientAppSetup.js 4:0-33
Module not found: Error: Can't resolve 'style-loader' in 'C:\Users\pierr\Documents\Code\kerunix\Bug Repros\test-version'
ERROR in ./node_modules/@vuepress/theme-default/lib/clientAppEnhance.js 5:0-29
Module not found: Error: Can't resolve 'style-loader' in 'C:\Users\pierr\Documents\Code\kerunix\Bug Repros\test-version'
ERROR in ./docs/.vuepress/.temp/pages/readme.vue
Module Error (from ./node_modules/vue-loader/lib/index.js):
[vue-loader] vue-template-compiler must be installed as a peer dependency, or a compatible compiler implementation must be passed via options.
ERROR in ./docs/.vuepress/.temp/pages/readme.vue
Module build failed (from ./node_modules/vue-loader/lib/index.js):
TypeError: Cannot read property 'parseComponent' of undefined
at parse (C:\Users\pierr\Documents\Code\kerunix\Bug Repros\test-version\node_modules\@vue\component-compiler-utils\dist\parse.js:15:23)
at Object.module.exports (C:\Users\pierr\Documents\Code\kerunix\Bug Repros\test-version\node_modules\vue-loader\lib\index.js:67:22)
ERROR in ./docs/.vuepress/.temp/pages/404.html.vue
Module Error (from ./node_modules/vue-loader/lib/index.js):
[vue-loader] vue-template-compiler must be installed as a peer dependency, or a compatible compiler implementation must be passed via options.
ERROR in ./docs/.vuepress/.temp/pages/404.html.vue
Module build failed (from ./node_modules/vue-loader/lib/index.js):
TypeError: Cannot read property 'parseComponent' of undefined
at parse (C:\Users\pierr\Documents\Code\kerunix\Bug Repros\test-version\node_modules\@vue\component-compiler-utils\dist\parse.js:15:23)
at Object.module.exports (C:\Users\pierr\Documents\Code\kerunix\Bug Repros\test-version\node_modules\vue-loader\lib\index.js:67:22)
ERROR in ./node_modules/@vuepress/plugin-back-to-top/lib/components/BackToTop.vue
Module Error (from ./node_modules/vue-loader/lib/index.js):
[vue-loader] vue-template-compiler must be installed as a peer dependency, or a compatible compiler implementation must be passed via options.
ERROR in ./node_modules/@vuepress/plugin-back-to-top/lib/components/BackToTop.vue
Module build failed (from ./node_modules/vue-loader/lib/index.js):
TypeError: Cannot read property 'parseComponent' of undefined
at parse (C:\Users\pierr\Documents\Code\kerunix\Bug Repros\test-version\node_modules\@vue\component-compiler-utils\dist\parse.js:15:23)
at Object.module.exports (C:\Users\pierr\Documents\Code\kerunix\Bug Repros\test-version\node_modules\vue-loader\lib\index.js:67:22)
ERROR in ./node_modules/@vuepress/theme-default/lib/components/global/Badge.vue
Module Error (from ./node_modules/vue-loader/lib/index.js):
[vue-loader] vue-template-compiler must be installed as a peer dependency, or a compatible compiler implementation must be passed via options.
ERROR in ./node_modules/@vuepress/theme-default/lib/components/global/Badge.vue
Module build failed (from ./node_modules/vue-loader/lib/index.js):
TypeError: Cannot read property 'parseComponent' of undefined
at parse (C:\Users\pierr\Documents\Code\kerunix\Bug Repros\test-version\node_modules\@vue\component-compiler-utils\dist\parse.js:15:23)
at Object.module.exports (C:\Users\pierr\Documents\Code\kerunix\Bug Repros\test-version\node_modules\vue-loader\lib\index.js:67:22)
ERROR in ./node_modules/@vuepress/theme-default/lib/components/global/CodeGroup.vue
Module Error (from ./node_modules/vue-loader/lib/index.js):
[vue-loader] vue-template-compiler must be installed as a peer dependency, or a compatible compiler implementation must be passed via options.
ERROR in ./node_modules/@vuepress/theme-default/lib/components/global/CodeGroup.vue
Module build failed (from ./node_modules/vue-loader/lib/index.js):
TypeError: Cannot read property 'parseComponent' of undefined
at parse (C:\Users\pierr\Documents\Code\kerunix\Bug Repros\test-version\node_modules\@vue\component-compiler-utils\dist\parse.js:15:23)
at Object.module.exports (C:\Users\pierr\Documents\Code\kerunix\Bug Repros\test-version\node_modules\vue-loader\lib\index.js:67:22)
ERROR in ./node_modules/@vuepress/theme-default/lib/components/global/CodeGroupItem.vue
Module Error (from ./node_modules/vue-loader/lib/index.js):
[vue-loader] vue-template-compiler must be installed as a peer dependency, or a compatible compiler implementation must be passed via options.
ERROR in ./node_modules/@vuepress/theme-default/lib/components/global/CodeGroupItem.vue
Module build failed (from ./node_modules/vue-loader/lib/index.js):
TypeError: Cannot read property 'parseComponent' of undefined
at parse (C:\Users\pierr\Documents\Code\kerunix\Bug Repros\test-version\node_modules\@vue\component-compiler-utils\dist\parse.js:15:23)
at Object.module.exports (C:\Users\pierr\Documents\Code\kerunix\Bug Repros\test-version\node_modules\vue-loader\lib\index.js:67:22)
ERROR in ./node_modules/@vuepress/theme-default/lib/components/global/OutboundLink.vue
Module Error (from ./node_modules/vue-loader/lib/index.js):
[vue-loader] vue-template-compiler must be installed as a peer dependency, or a compatible compiler implementation must be passed via options.
ERROR in ./node_modules/@vuepress/theme-default/lib/components/global/OutboundLink.vue
Module build failed (from ./node_modules/vue-loader/lib/index.js):
TypeError: Cannot read property 'parseComponent' of undefined
at parse (C:\Users\pierr\Documents\Code\kerunix\Bug Repros\test-version\node_modules\@vue\component-compiler-utils\dist\parse.js:15:23)
at Object.module.exports (C:\Users\pierr\Documents\Code\kerunix\Bug Repros\test-version\node_modules\vue-loader\lib\index.js:67:22)
ERROR in ./node_modules/@vuepress/theme-default/lib/layouts/Layout.vue
Module Error (from ./node_modules/vue-loader/lib/index.js):
[vue-loader] vue-template-compiler must be installed as a peer dependency, or a compatible compiler implementation must be passed via options.
ERROR in ./node_modules/@vuepress/theme-default/lib/layouts/Layout.vue
Module build failed (from ./node_modules/vue-loader/lib/index.js):
TypeError: Cannot read property 'parseComponent' of undefined
at parse (C:\Users\pierr\Documents\Code\kerunix\Bug Repros\test-version\node_modules\@vue\component-compiler-utils\dist\parse.js:15:23)
at Object.module.exports (C:\Users\pierr\Documents\Code\kerunix\Bug Repros\test-version\node_modules\vue-loader\lib\index.js:67:22)
ERROR in ./node_modules/@vuepress/theme-default/lib/layouts/404.vue
Module Error (from ./node_modules/vue-loader/lib/index.js):
[vue-loader] vue-template-compiler must be installed as a peer dependency, or a compatible compiler implementation must be passed via options.
ERROR in ./node_modules/@vuepress/theme-default/lib/layouts/404.vue
Module build failed (from ./node_modules/vue-loader/lib/index.js):
TypeError: Cannot read property 'parseComponent' of undefined
at parse (C:\Users\pierr\Documents\Code\kerunix\Bug Repros\test-version\node_modules\@vue\component-compiler-utils\dist\parse.js:15:23)
at Object.module.exports (C:\Users\pierr\Documents\Code\kerunix\Bug Repros\test-version\node_modules\vue-loader\lib\index.js:67:22)
webpack compiled with 22 errors
success VuePress webpack dev server is listening at http://localhost:8081/
I tried to fix the above errors by installing the dependencies that were required with
yarn add -D style-loader
yarn add -D vue-template-compiler
I also believes the issue was related to a conflicting version of vue-loader so I installed version 16.1.2 in my project without any success.
Both solutions changed the error messages outputed in the console but I did not include them in the provided reproduction because I figured maybe you wanted to tinker with it.
vuepress info
: System:
OS: Windows 10 10.0.19041
CPU: (8) x64 Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz
Memory: 3.68 GB / 15.96 GB
Binaries:
Node: 12.18.4 - C:\Program Files\nodejs\node.EXE
Yarn: 1.12.3 - C:\Program Files (x86)\Yarn\bin\yarn.CMD
npm: 6.14.6 - C:\Program Files\nodejs\npm.CMD
Utilities:
Git: 2.16.2. - /mingw64/bin/git
Browsers:
Chrome: 88.0.4324.182
Edge: Spartan (44.19041.423.0), Chromium (88.0.705.68)
npmPackages:
@vuepress/bundler-webpack: 2.0.0-alpha.24
@vuepress/cli: 2.0.0-alpha.24
@vuepress/client: 2.0.0-alpha.24
@vuepress/core: 2.0.0-alpha.24
@vuepress/markdown: 2.0.0-alpha.24
@vuepress/plugin-active-header-links: 2.0.0-alpha.24
@vuepress/plugin-back-to-top: 2.0.0-alpha.24
@vuepress/plugin-container: 2.0.0-alpha.24
@vuepress/plugin-debug: Not Found
@vuepress/plugin-docsearch: Not Found
@vuepress/plugin-git: 2.0.0-alpha.24
@vuepress/plugin-google-analytics: Not Found
@vuepress/plugin-medium-zoom: 2.0.0-alpha.24
@vuepress/plugin-nprogress: 2.0.0-alpha.24
@vuepress/plugin-palette-stylus: 2.0.0-alpha.24
@vuepress/plugin-pwa: Not Found
@vuepress/plugin-pwa-popup: Not Found
@vuepress/shared: 2.0.0-alpha.24
@vuepress/theme-default: 2.0.0-alpha.24
@vuepress/theme-vue: Not Found
@vuepress/utils: 2.0.0-alpha.24
vue: ^3.0.0 => 3.0.5
vue-loader: 15.9.6 (16.1.2)
vue-router: 4.0.4
vuepress: ^2.0.0-alpha.24 => 2.0.0-alpha.24
Would it be possible to please make this repo available as a package via npm
or yarn
?
Attempts to install directly from git raise Can't add undefined: invalid package version undefined
errors.
Thanks.
I saw v1 use only padding
in styles/code, this line split to margin
and padding
in v2, and an unexpected character rem
was left. Is it on purpose?
It works well now, stylus use it to override the unit of variable. However, if user set it with a different unit, this may cause an error:
// stylus
$lineNumbersWrapperWidth: 3.5px;
margin-left: $lineNumbersWrapperWidth rem;
// compiled css
margin-left: 3.5rem;
Or eject default theme and change it to scss/less:
// scss
$lineNumbersWrapperWidth: 3.5px;
margin-left: $lineNumbersWrapperWidth rem;
// compiled css
margin-left: 3.5px rem;
None
Delete rem
:
margin-left: $lineNumbersWrapperWidth;
None
enhanceApp.js, I can install ElementUI
by
export default ({ Vue, options, router }) => {
Vue.use(Element);
};
But I can't use Vue.install
at this time. And it seems like my clientAppEnhance.js doesn't work, I can't console.log or alert what you supported in it, this function seems not to be executed.
Please add any docs on clientAppEnhance~
Questions:
Is there a way to access themeConfig in plugin options?
We used to access it through context
, but it is now replaced by app
provided by vue3. And current plugins are not accessing it, so I am not sure how to access it or whether I can access it in vuepress2
Improvements suggestions:
We can use script link to link script part and compile it to js. Both vitepress and my theme is doing this way. It can help to speed up the serve and build time. So I would like to suggest removing the runtime typescript for the default theme. Also this can let the users drop the typescript deps, while they can still use this along with typescript.
Due to the new useApi, some plugins may wanna provide some useApi funtions or wanna export some types(e.g.: vuepress-plugin-blog
has to do so), but with the common js design, we can only use export =
in typescript and it's a bit inconvinient for us to hang those functions on this plugin object:
const options = (options: XXXOptions) => xxx;
options.useXXX = useXXX;
export = options;
And also we have to write the declaration files intead of generating them. in order to provide type export.
So can we both support plugin exporting a funtion and a object with a setup
(or something like install
)? Just like what vue is doing. It would be better for developers to export other types and funtions.
Also this can be a new breaking change because when the plugin is exporting an object, it should also use:
module.exports = () =>({
...
});
By the way, the mixed es module and common js can be really annoying when using typescript, especially you want to require one file in both es module and commonjs files.
Also, I am preparing the Postgraduate Exam on Dec 26th, but I would like to help with the pwa plugins and seo plugins for vuepress2, so if you can wait till Dec 31th, I can help with them after my exam.
These are my plugins, and they are both powerful than @vuepress/plugin-pwa
and vuepress-plugin-seo
, and I can make them compatable with vuepress2 and make some improvements with the new feature:
And since we can inject script and links in head, so it can be more powerful in vuepress2.
I think seo is important for documentations and blog sites, so in my opinion, it would be better maitained by the official.
Is there a USE API now like const frontmatter = useFrontmatter()
to access them in setup?
BTW: I would like to help with markdown and theme-default.
Users may import @vuepress/client
on node side for serveral reasons:
To provide composables and export them in main.
E.g.: A plugin may provide a useXXX
api. And we may want user to import { useXXX } from 'YYY'
instead of import { useXXX } from 'YYY/lib/composable'
To import some functions and use it in pluginObject. (Just as I ask in #47 such as resolveSiteLocaleData
)
To import types such as PageFrontmatter
(ESM syntax on this situation is not causing issues)
If @vuepress/client
only has esm syntax, we have to be extra careful to make sure the main entrance is not importing any functions, just it's types. Or we will get errors like Unexpected token 'export'
.
So I hope @vuepress/client
can export both with main
and module
Looking at https://github.com/vuepress/vuepress-next/blob/main/packages/%40vuepress/markdown/src/markdown.ts I don't see any way to use markdown-it plugin, e.g.:
markdown: {
plugins: { 'markdown-it-include': {} },
},
Am I missing something or this is not supported yet?
Since the chainWebpack on PluginApi removed, is there any way to configure it on developing theme? Actually what I want is to enable jsx-next for vuepress-next
It seems that Search Box doesn't be supported in vuepress-next, I can't find it the doc and readme.
Support Search box
Can not import images from sub directories.
This makes an error :
![image](../images/image.png)
It should be possible to import images from anywhere
vuepress info
:System:
Shell: 5.1.4 - /usr/local/bin/bash
Binaries:
Node: 15.5.1 - /usr/local/bin/node
Yarn: Not Found
npm: 7.3.0 - /usr/local/bin/npm
Utilities:
Git: 2.30.0 - /usr/local/bin/git
Browsers:
Chrome: 83.0.4103.116
Edge: Not Found
Firefox: 84.0.2
Safari: 13.1.2
npmPackages:
@vuepress/bundler-webpack: 2.0.0-alpha.15
@vuepress/cli: 2.0.0-alpha.15
@vuepress/client: 2.0.0-alpha.15
@vuepress/core: 2.0.0-alpha.15
@vuepress/markdown: 2.0.0-alpha.15
@vuepress/plugin-active-header-links: 2.0.0-alpha.15
@vuepress/plugin-back-to-top: 2.0.0-alpha.15
@vuepress/plugin-container: 2.0.0-alpha.15
@vuepress/plugin-debug: 2.0.0-alpha.15
@vuepress/plugin-docsearch: Not Found
@vuepress/plugin-git: 2.0.0-alpha.15
@vuepress/plugin-google-analytics: Not Found
@vuepress/plugin-medium-zoom: 2.0.0-alpha.15
@vuepress/plugin-nprogress: 2.0.0-alpha.15
@vuepress/plugin-palette-stylus: 2.0.0-alpha.15
@vuepress/plugin-pwa: Not Found
@vuepress/plugin-pwa-popup: Not Found
@vuepress/shared: 2.0.0-alpha.15
@vuepress/theme-default: 2.0.0-alpha.15
@vuepress/theme-vue: Not Found
@vuepress/utils: 2.0.0-alpha.15
vuepress: ^2.0.0-alpha.15 => 2.0.0-alpha.15
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.