ktsn / vue-template-loader

Vue.js 2.0 template loader for webpack
MIT License
266 stars 26 forks source link

feat: Support uri fragment in transformed require #49

Closed joma74 closed 6 years ago

joma74 commented 6 years ago

Hello katashin,

My case for this PR is a svg within a html based vue component, where i deployed vue-template-loader for this usage. In this html i put a svg element as in

<svg>
    <use href="~@svg/menu.svg#menu"></use>
</svg>

After banging my head over webpack's Module not found: Error i found out that this case may be covered by vue-template-loader, which is the purpose of this PR. Root cause is that the whole href is generated by vue-template-loader and as-is is required by webpack; this must fail because the whole href - including the uri fragment #menu - is not part of any mapped physical file location of such an svg.

Kindly request you to consider this PR; If the PR does not meet your accepted standards, after your feedback i would alternatively like to bring that in as a seperate feature request issue.

ktsn commented 6 years ago

Thanks for your contribution. Would you mind making PR to vuejs/component-compiler-utils instead because vue-template-loader now completely rely on it in terms of asset transformation?