FranckFreiburger / vue3-sfc-loader

Single File Component loader for Vue2 and Vue3. Load .vue files directly from your HTML. No node.js environment, no build step.
MIT License
1.03k stars 116 forks source link

Add binary data support #69

Closed FranckFreiburger closed 3 years ago

FranckFreiburger commented 3 years ago

Is your feature request related to a problem? Please describe. At the moment it is not possible to require binary data (eg. import logo from "../images/logo.png";)

Describe the solution you'd like The solution is to mimic how fetch() handle this :

  1. fetch the resource
  2. use the right API to get the data as text or as binary (see https://developer.mozilla.org/en-US/docs/Web/API/Body)

Additional context see discussion https://github.com/FranckFreiburger/vue3-sfc-loader/discussions/60

Note This implies a breaking changes for the API options.getFile() and type File

getFile() will continue to support a simple string as return value but the object form will be : { type, getContentData } instead of { type, content }