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

216
Visualizações
Error connecting Vue.js components via CDN

I write a simple blog. I made the public part in PHP + JS, I want to write the admin panel in PHP + Vue.js

Connecting via CDN is not difficult, but how do you connect components after that? At normal connection gives an error.

Cannot use import statement outside a module

If you write type="module", then

Expected a JavaScript module script but the server responded with a MIME type of "". Strict MIME type checking is enforced for module scripts per HTML spec.

Apparently, there must be another way. I struggle for a long time, I can not find answers on the Internet.

Files now
ADMIN
 |__ admin.php
 |__ main.js
 |
 |__ components
      |__ App.vue

// main.js
const app = Vue.createApp({
    data() {
        return {
            test: 11,
        }
    },
});

app.mount('#app');
<!-- admin.php -->
<!doctype html>
<html lang="ru">
<head>
    <title>ADMIN PANEL</title>
    <script src="https://unpkg.com/vue@3"></script>
</head>
<body>
    <div id="app">
        {{ test}}
    </div>
</body>
</html>

<script src="/views/admin/main.js" type="module" ></script>

about 4 years ago · Juan Pablo Isaza
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