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

130
Visualizações
Blazor Webassembly multiple exports in single JS file returns error when minimized

I am trying to add get and set blazor culture as advised in the Microsoft Documentation. According to the documentation, i can put the get and set Blazorculture in a single JS with 2 exports like below

The preceding example pollutes the client with global methods. For a better approach in production apps, see JavaScript isolation in

JavaScript modules.

Example:

JavaScript

 
export function getBlazorCulture() {
  return window.localStorage['BlazorCulture'];
};
export function setBlazorCulture(value) {
  window.localStorage['BlazorCulture'] = value;
};
If you use the preceding functions, change the JS interop calls in this section from blazorCulture.get to getBlazorCulture and from

blazorCulture.set to setBlazorCulture.

So i created a single Js file as below, i have tried using export on both function and as well as like using exports as below but error didnt go away.

export function getBlazorCulture() {
  return window.localStorage['BlazorCulture'];
};
export function setBlazorCulture(value) {
  window.localStorage['BlazorCulture'] = value;
};



function getBlazorCulture() {
    return window.localStorage['BlazorCulture'];
};

function setBlazorCulture(value) {
    window.localStorage['BlazorCulture'] = value;
};
exports {getBlazorCulture,setBlazorCulture}

that seems to be working fine but once I minimize this min.js, I am getting error message as

enter image description here

minimized js looks like

"use strict";function getBlazorCulture(){return window.localStorage.BlazorCulture}function setBlazorCulture(n){window.localStorage.BlazorCulture=n}Object.defineProperty(exports,"__esModule",{value:!0});exports.getBlazorCulture=getBlazorCulture;exports.setBlazorCulture=setBlazorCulture;

using on separate Js files, no error.

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