vuejs / vitepress

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

Can't build when files are missing (ignoreDeadLinks is not working) #3081

Open personalsoft-fabianobonin opened 1 year ago

personalsoft-fabianobonin commented 1 year ago

Describe the bug

Hi,

I'm currently working on a project where I'd like to proceed with building despite any dead links or missing resources. While I understand that it's best practice to have a documentation without these issues, I believe it's more important to generate a build even with potential inconsistencies.

I enabled the option ignoreDeadLinks: true but I am not able to build.

It complains about a productUnit.png file which is missing indeed, but I would like to build anyway.

How can I achieve this?

As a side note, I typically keep my assets such as images, spreadsheets, and PDFs in the same folder as my markdown files.

Regards,

Fabiano

⠼ building client + server bundles...Could not resolve "./productUnit.png" from "src/app/catalog/product/productUnit.md"
file: /opt/zen.erp.docs.engine/src/app/catalog/product/productUnit.md
✖ building client + server bundles...
build error:
RollupError: Could not resolve "./productUnit.png" from "src/app/catalog/product/productUnit.md"
    at error (file:///opt/zen.erp.docs.engine/node_modules/rollup/dist/es/shared/node-entry.js:2287:30)
    at ModuleLoader.handleInvalidResolvedId (file:///opt/zen.erp.docs.engine/node_modules/rollup/dist/es/shared/node-entry.js:24860:24)
    at file:///opt/zen.erp.docs.engine/node_modules/rollup/dist/es/shared/node-entry.js:24822:26

Reproduction

Could not reproduce in stackblitz:

https://stackblitz.com/edit/vite-vzvbjb?file=docs%2F.vitepress%2Fconfig.ts

Expected behavior

To build the docs

System Info

vitepress 1.0.0-rc.20

Additional context

No response

Validations

brc-dd commented 1 year ago

This isn't supported currently. ignoreDeadLinks is only for pages not assets.

personalsoft-fabianobonin commented 1 year ago

Do you have any insights into how StackBlitz is able to successfully build even when an asset is missing? If they've achieved this, there's likely a method I can implement as well.

The current behavior poses a significant obstacle for various scenarios. I manage a team responsible for generating documentation, and we have an automated build process triggered by a GitHub webhook. If any of my team members accidentally push a page with an invalid asset, it halts the entire documentation build process until someone manually inspects the logs.

Regards,

Fabiano

brc-dd commented 1 year ago

Do you have any insights into how StackBlitz is able to successfully build even when an asset is missing?

It doesn't. You probably are running the dev command.

image