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 inJavaScript 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 fromblazorCulture.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
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.