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

doc(fix vuejs/core#11367):add a warn about '~' in src-imports #3061

Merged
merged 5 commits into from
Oct 18, 2024
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions src/api/sfc-spec.md
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,13 @@ Beware that `src` imports follow the same path resolution rules as webpack modul
</unit-test>
```

:::warning Note
While using aliases in `src`, don't start with `~`(it can be used in `import` seq ), anything after it is interpreted as a module request. This means you can reference assets inside node modules:
Bayn-Web marked this conversation as resolved.
Show resolved Hide resolved
```vue
<img src="~some-npm-package/foo.png">
```
:::

## Comments {#comments}

Inside each block you shall use the comment syntax of the language being used (HTML, CSS, JavaScript, Pug, etc.). For top-level comments, use HTML comment syntax: `<!-- comment contents here -->`