4

I would like to ask what is the best approach to include and reuse Vue components that are written in .vue files (SFC), into existing web pages.

For example lets say there is already an SPA project and also an ASP Core project. I would like to reuse my ~/SPA Dir/components/*.vue into my Razor pages or just plain HTML pages. To be more specific the web pages are using Vue through the CDN js file.

In most Vue tutorials it is often mentioned how Vue is used to create SPAs or it can be used in already existing web pages. And there is also emphasis on the reusability of its' components. But it seems very frustrating and complex to follow those guidelines with often lacking and unclear guides.

From my research I realize that there must be an intermediate build process that will produce js files form the vue files. And also the need of tools like vue-loader and webpack. But still I could not find something straight to the point.

Is there a more straightforward approach or what is the most common approach to the above-mentioned scenario.

(Vue version: 3)

Thank you

1 Answer 1

1

Maybe try this SFC loader: https://github.com/FranckFreiburger/vue3-sfc-loader

I use it on my PHP server, where I have my .vue components and I need to compile them as .js.

Sign up to request clarification or add additional context in comments.

1 Comment

While this link may answer the question, it is better to include the essential parts of the answer here and provide the link for reference. Link-only answers can become invalid if the linked page changes. - From Review

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.