Skip to content

Commit

Permalink
Legg til assetManifestParser
Browse files Browse the repository at this point in the history
  • Loading branch information
Mathiamu committed Jan 29, 2025
1 parent 19e3e9d commit a0c5294
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/component/spa.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,22 @@ export const vedtaksstotteAsyncConfig: AsyncSpaConfig = {
loader: <Spinner />,
config: {
wrapperClassName: spaWrapperTabContentClassName
},

assetManifestParser: manifest => {
const isWebpackManifest = 'entrypoints' in manifest;
const baseUrl = erITestMiljo()
? utledVedtaksstotteCdnUrl('veilarbvedtaksstottefs/build')
: utledSpaUrl(SpaName.VEILARBVEDTAKSSTOTTEFS);
if (isWebpackManifest) {
return createAssetManifestParser(baseUrl)(manifest);
} else {
// Vitejs manifest
const { file, css } = manifest['index.html'];
const styles = css.map((path: string) => ({ path: `${baseUrl}/${path}` }));
const entry = { type: 'module', path: `${baseUrl}/${file}` };
return [entry, ...styles];
}
}
};

Expand Down

0 comments on commit a0c5294

Please sign in to comment.