vitejs / vite-plugin-vue2

Vite plugin for Vue 2.7
MIT License
543 stars 46 forks source link

[bug] asset starts with '~@' resolved error #59

Open JonathanLee-LX opened 1 year ago

JonathanLee-LX commented 1 year ago

asset starts with '~@' resolved error

example

src/bar/foo.vue

<template>
   <img src='~@assets/foo.png'/>
</template>

compiled

// actually 
/src/bar/@assets/foo.png

// expected
src/assets/foo.png

vite.config.ts

import vue from '@vitejs/plugin-vue2'
import { defineConfig } from 'vite'

defineConfig({
  plugins: [vue()],
})
JonathanLee-LX commented 1 year ago

I think it should be caused by this line of code

https://github.com/vitejs/vite-plugin-vue2/blob/06ede94bcc1b639f01b0defb5cbfd287052cde83/src/template.ts#L117