http-vue-loader icon indicating copy to clipboard operation
http-vue-loader copied to clipboard

Either source string as input or at least work with data-URIs

Open sp00x opened this issue 6 years ago • 3 comments

Would it be possible to get the constructor to take a inline sourced string as input, instead of requiring a URL? (maybe with a base path for any images or whatever the template might refer to)

Alternatively I tried passing the source as a data-uri string, but then I get an error: httpVueLoader.js:453 GET data:text/plain;base64,xxxxxxxxx/index.vue net::ERR_INVALID_URL (apparently it tries to append /index.vue)

sp00x avatar Apr 13 '18 09:04 sp00x

(I also tried writing a custom httpVueLoader.httpRequest to intercept data: urls and just return a Promise with the decoded body, but then I run into another issue: 'data' URLs may not be used as base URLs for a document. )

sp00x avatar Apr 13 '18 09:04 sp00x

@sp00x There is a function that parses and decomposes the url called parseComponentURL. That's where /index.vue is appended. maybe you can modify it to handle data-uris as well as blob urls.

DimuDesigns avatar Dec 30 '18 20:12 DimuDesigns

I made a pull request to support it: #112 This supports string input, inline element and data-URLs.

terraloader avatar May 08 '20 13:05 terraloader