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

282
Visualizações
Vue 3 : webpack scriptType options issues

I'm using Vue3 to build an offline application.

"To be clear the application planed to be open through an url like file://"

However since Vue3 introduced the modern version i'm getting CORS issues... It's mostly due to the fact that the property type="module" as been added to each script tags.

example:

<script defer="defer" type="module" src="js/app.b9b6cfbc.js"></script>

Error:

Access to script at 'file:///Users/[...]/project/js/app.dc625bea.js' from origin 'null' has been blocked by CORS policy: Cross origin requests are only supported for protocol schemes: http, https, ipns, chrome-untrusted, ipfs, data, chrome, chrome-extension.

Then when i remove the attribute "type" it works....

So I have been researching on how to remove that tag while webpack is compiling the app, I have been updating the output.scriptType options, however it sounds like the options is not been used... I'm still getting the same result

My vue.config.js:

const path = require('path')
module.exports = {
  publicPath: '.',
  outputDir: path.resolve(__dirname, './dist'),
  transpileDependencies: [
    'vue-echarts',
    'resize-detector'
  ],
  configureWebpack: {
    target: ['web', 'es5'],
    optimization: {
      splitChunks: false
    },
    output: {
      scriptType: 'text/javascript'
    }
  },
  devServer: {
    port: 3000
  }
}

Is it a webpack or vue3 issues?

about 4 years ago · Santiago Trujillo
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