NuxtN
Nuxt2y ago
2 replies
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;
}
Was this page helpful?