Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: build metaData from a deep clone of the template #4851

Merged
merged 1 commit into from
Aug 23, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions app/config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import fs from 'fs';
import path from 'path';
import cloneDeep from 'lodash/cloneDeep';
import defaultConfig from './configurations/config.default';
import configMerger from './util/configMerger';
import { boundWithMinimumAreaSimple } from './util/geo-utils';
Expand All @@ -8,6 +9,8 @@ const configs = {}; // cache merged configs for speed
const themeMap = {};
// Look up paths for various asset files
const appRoot = `${process.cwd()}/`;
// eslint-disable-next-line global-require
const metaDataTemplate = require('./ssrmeta.json');

if (defaultConfig.themeMap) {
Object.keys(defaultConfig.themeMap).forEach(theme => {
Expand Down Expand Up @@ -42,8 +45,8 @@ function addMetaData(config) {
}
}
// read metadata template and modify it to match image assets generated by favicons-webpack-plugin
// eslint-disable-next-line global-require, import/no-unresolved, no-param-reassign
config.metaData = require('./ssrmeta.json');
// eslint-disable-next-line no-param-reassign
config.metaData = cloneDeep(metaDataTemplate);
config.metaData.link.forEach(link => {
// eslint-disable-next-line no-param-reassign
link.href = link.href.replace('<themehash>', manifestName);
Expand Down
Loading