QingWei-Li / vue-markdown-loader

📇 Convert Markdown file to Vue2.0 component.
704 stars 162 forks source link

Vue Single File templates seem to only support one script tag #35

Closed cajames closed 7 years ago

cajames commented 7 years ago

Came across an issue when dealing with a page which had multiple <script> blocks.

https://github.com/vuejs/vue-loader/issues/228

I had a main <script> block, and the rest were in the html fences. Thanks to preventExtract: false, these extra script tags get injected and break the component. I wish to use preventExtract however, only use the first script tag to be used for the component.

The fix I've made will take the first script block it sees as the single-file-component's script block. Not sure if this is the best way of solving this issue, open to suggestions.