@vitejs/plugin-vue
Advanced tools
Comparing version 3.0.0-alpha.0 to 3.0.0-alpha.1
{ | ||
"name": "@vitejs/plugin-vue", | ||
"version": "3.0.0-alpha.0", | ||
"version": "3.0.0-alpha.1", | ||
"license": "MIT", | ||
@@ -5,0 +5,0 @@ "author": "Evan You", |
@@ -54,2 +54,36 @@ # @vitejs/plugin-vue [![npm](https://img.shields.io/npm/v/@vitejs/plugin-vue.svg)](https://npmjs.com/package/@vitejs/plugin-vue) | ||
## Asset URL handling | ||
When `@vitejs/plugin-vue` compiles the `<template>` blocks in SFCs, it also converts any encountered asset URLs into ESM imports. | ||
For example, the following template snippet: | ||
```vue | ||
<img src="../image.png" /> | ||
``` | ||
Is the same as: | ||
```vue | ||
<script setup> | ||
import _imports_0 from '../image.png' | ||
</script> | ||
<img src="_imports_0" /> | ||
``` | ||
By default the following tag/attribute combinations are transformed, and can be configured using the `template.transformAssetUrls` option. | ||
```js | ||
{ | ||
video: ['src', 'poster'], | ||
source: ['src'], | ||
img: ['src'], | ||
image: ['xlink:href', 'href'], | ||
use: ['xlink:href', 'href'] | ||
} | ||
``` | ||
Note that only attribute values that are static strings are transformed. Otherwise, you'd need to import the asset manually, e.g. `import imgUrl from '../image.png'`. | ||
## Example for passing options to `vue/compiler-sfc`: | ||
@@ -68,10 +102,3 @@ | ||
transformAssetUrls: { | ||
// default tags | ||
tags: { | ||
video: ['src', 'poster'], | ||
source: ['src'], | ||
img: ['src'], | ||
image: ['xlink:href', 'href'], | ||
use: ['xlink:href', 'href'] | ||
} | ||
// ... | ||
} | ||
@@ -78,0 +105,0 @@ } |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Debug access
Supply chain riskUses debug, reflection and dynamic code execution features.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
157209
4802
162
21
0