Socket
Socket
Sign inDemoInstall

@vitejs/plugin-vue

Package Overview
Dependencies
Maintainers
4
Versions
107
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@vitejs/plugin-vue - npm Package Compare versions

Comparing version 3.0.0-alpha.0 to 3.0.0-alpha.1

2

package.json
{
"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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc