Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

488
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda