Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

485
Views
Compiling *.vue file to *.js file for using in cdn

Are there any methods to compile some Component.vue files to some javascript file? So that compiled js can be included in HTML and used with vue CDN.

For example, Lets' say we have some component Component.vue, given below


<template>
    <div class="demo">{{ msg }}</div>
</template>
<script>
export default {
    data() {
        return {
            msg: "Jatin Garg",
        };
    },
};
</script>

<style scoped>
.demo {
    color: blue;
}
</style>

Now we want to include the compiled Component.js in below HTML file.

<html lang="en">
    <head>
        <script src="/path/to/Component.js"></script>
        <script src="vue@next"></script>
        <body>
            <div id="app">
                <component></component>
            </div>
        </body>
        <script>
            const app = Vue.createApp({});
            app.component("component", Component);
            app.mount("#app");
        </script>
    </head>
    <body></body>
</html>

I know a library called vue3-sfc-loader that does a similar thing. But rather using ".js" file it directly takes the Component.vue file and compiles it. Basically, I want to compile the .vue file offline

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

The point is that you need to convert your file, not compile it. So you can to find a script that could do this, or create it by yourself.

Here is the answer to the similar question with a suitable script.

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!