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

vitepress不支持.awebp格式文件 #3076

Closed
4 tasks done
wushuang5112 opened this issue Oct 12, 2023 · 2 comments
Closed
4 tasks done

vitepress不支持.awebp格式文件 #3076

wushuang5112 opened this issue Oct 12, 2023 · 2 comments
Labels
upstream Related to the dependencies

Comments

@wushuang5112
Copy link

Describe the bug

⠇ building client + server bundles...[vite:build-import-analysis] Parse error @:2:129
file: /data/www.wushuang5112.wang/docs/01FE/nodejs/resources/stream.awebp:2:128
WEBPVP8X
2: vRALPH����!���I�I����Njb;gn��3c�bۨضQ���m��<;�=����q�HRi��v�Y�L�/��S�����?�l.rwM�앇/ݫ_��/l.R�4������\�2�\�3}���ys�ґ...
^
3: ��)B
�������v%��)�*2�XF�z�Q�mT�&�Y6j�
4: *$c�J���h�X/q���K��}��o2��u.y�8�|���
✖ building client + server bundles...
xterm-256colorbuild error:
Error: Parse error @:2:129
at parse$e (file://node_modules/.pnpm/vite@4.4.11/node_modules/vite/dist/node/chunks/dep-2b82a1ce.js:16497:355)
at Object.transform (file://node_modules/.pnpm/vite@4.4.11/node_modules/vite/dist/node/chunks/dep-2b82a1ce.js:46642:27)
 ELIFECYCLE  Command failed with exit code 1.

Reproduction

{
  "type": "module",
  "name": "website",
  "version": "1.0.0",
  "description": "self website",
  "scripts": {
    "docs:dev": "vitepress dev docs",
    "docs:build": "vitepress build docs",
    "docs:serve": "vitepress serve docs"
  },
  "main": "index.js",
  "license": "MIT",
  "devDependencies": {
    "vitepress": "^1.0.0-alpha.48",
    "vue": "^3.2.47"
  }
}

从报错上来看是因为解析不了*.awebp文件,缺少Loader支持

Expected behavior

通过项目编译时出现了如下报错,可能是不支持*.awebp文件;

pnpm run docs:build

System Info

window & ubuntu 22.04

Additional context

No response

Validations

@wushuang5112 wushuang5112 added the bug: pending triage Maybe a bug, waiting for confirmation label Oct 12, 2023
@zonemeen
Copy link
Collaborator

zonemeen commented Oct 12, 2023

There is indeed this problem, you can temporarily put the awebp images in the public folder.

@brc-dd
Copy link
Member

brc-dd commented Oct 12, 2023

awebp is not there in vite's known assets. add this to your config:

// .vitepress/config.ts
import { defineConfig } from 'vitepress'

export default defineConfig({
  vite: {
    assetsInclude: ['**/*.awebp']
  }
})

If you want, feel free to create a PR at vite. You'll need to update this part - https://github.com/vitejs/vite/blob/main/packages/vite/src/node/constants.ts#L97

@brc-dd brc-dd closed this as completed Oct 12, 2023
@brc-dd brc-dd added upstream Related to the dependencies and removed bug: pending triage Maybe a bug, waiting for confirmation labels Oct 12, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 20, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
upstream Related to the dependencies
Projects
None yet
Development

No branches or pull requests

3 participants