Closed shaan1974 closed 3 years ago
Hi shaan1974,
To handle this situation, your getFile()
should inform vue3-sfc-loader that these .php
files generate .vue
content :
async getFile(url) {
const res = await fetch(url);
if ( !res.ok )
throw Object.assign(new Error(url + " " + res.statusText), { res });
const content = await res.text();
return /\/vue\/components\/.*?\.php/.test(url) ? { content: content, extname: ".vue" } : content;
},
Think extname
like a kind of mimetype.
Here we tell vue3-sfc-loader that vue/components/**/*.php
generate SFC content.
Thanks a lot for you help you save my live ;) By the way nice job, because i'm not a big fan of Cli tools.
I'm closing this as answered. Discussion can continue if needed.
Hello,
First thanks for this great tool.
My problem. I just want to use a .php file in place of a .vue file into the loadModule function but it's not working. it told me : "TypeError: Unable to handle .php files (js/vue/components/hello_world/test.php), see additionalModuleHandlers"
i'v try to add in config:
additionalModuleHandlers: { '.php': function(source, path, options) { return source; } }
But it's not working at all. May be i'm doing some wrong ?
Thanks