N
Nuxt9mo ago
Lannister

Uncaught TypeError: Cannot read properties of undefined (reading 'baseURL')

Only when pre-rendering my homepage in production, I see this error in the console: Uncaught TypeError: Cannot read properties of undefined (reading 'baseURL') I disabled code minification to see the clear code in the production build:
const appConfig = useRuntimeConfig$1().app;
const baseURL = () => appConfig.baseURL; //Complains here.
const buildAssetsDir = () => appConfig.buildAssetsDir;
const buildAssetsURL = (...path) => joinRelativeURL(publicAssetsURL(), buildAssetsDir(), ...path);
const publicAssetsURL = (...path) => {
const publicBase = appConfig.cdnURL || appConfig.baseURL;
return path.length ? joinRelativeURL(publicBase, ...path) : publicBase;
};

{
globalThis.__buildAssetsURL = buildAssetsURL;
globalThis.__publicAssetsURL = publicAssetsURL;
}
const appConfig = useRuntimeConfig$1().app;
const baseURL = () => appConfig.baseURL; //Complains here.
const buildAssetsDir = () => appConfig.buildAssetsDir;
const buildAssetsURL = (...path) => joinRelativeURL(publicAssetsURL(), buildAssetsDir(), ...path);
const publicAssetsURL = (...path) => {
const publicBase = appConfig.cdnURL || appConfig.baseURL;
return path.length ? joinRelativeURL(publicBase, ...path) : publicBase;
};

{
globalThis.__buildAssetsURL = buildAssetsURL;
globalThis.__publicAssetsURL = publicAssetsURL;
}
1 Reply
Lannister
LannisterOP9mo ago
routeRules: {
'/': { prerender: true },
},
routeRules: {
'/': { prerender: true },
},
const fetch = _globalThis$1.fetch || (() => Promise.reject(new Error("[ofetch] global.fetch is not supported!")));
const Headers = _globalThis$1.Headers;
const AbortController = _globalThis$1.AbortController;
const ofetch = createFetch({ fetch, Headers, AbortController });
const $fetch$1 = ofetch;

if (!globalThis.$fetch) {
globalThis.$fetch = $fetch$1.create({
baseURL: baseURL() //Complains here...
});
}
const fetch = _globalThis$1.fetch || (() => Promise.reject(new Error("[ofetch] global.fetch is not supported!")));
const Headers = _globalThis$1.Headers;
const AbortController = _globalThis$1.AbortController;
const ofetch = createFetch({ fetch, Headers, AbortController });
const $fetch$1 = ofetch;

if (!globalThis.$fetch) {
globalThis.$fetch = $fetch$1.create({
baseURL: baseURL() //Complains here...
});
}
Want results from more Discord servers?
Add your server