Skip to content

Commit

Permalink
fix(stark-build): fix index-html transform script to support ng12 pro…
Browse files Browse the repository at this point in the history
…duction build
  • Loading branch information
SuperITMan committed Aug 16, 2021
1 parent 44502de commit aab9a4f
Showing 1 changed file with 12 additions and 15 deletions.
27 changes: 12 additions & 15 deletions packages/stark-build/config/index-html.transform.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,25 +21,22 @@ const METADATA = require("./webpack-metadata").METADATA;
* @returns {string}
*/
function replacePlaceholdersByValues(indexHtml) {
const regex = /<%=\sstarkOptions\.(starkAppMetadata|starkAppConfig|metadata)\.\w+\s%>/g;
const regex = /(?:<|&lt;)%=\s+starkOptions\.(starkAppMetadata|starkAppConfig|metadata)\.(\w+)\s+%(?:>|&gt;)/g;

const getRealValue = (placeholder) => {
const str = placeholder.slice(4, -3).split(".");
if (str.length === 3) {
const configName = str[1];
const property = str[2];
const getRealValue = (placeholder, ...args) => {
const configName = args[0];
const property = args[1];

let value;
let value;

if (configName === "metadata") {
value = METADATA[property];
} else {
value = commonData[configName][property];
}
if (configName === "metadata") {
value = METADATA[property];
} else {
value = commonData[configName][property];
}

if (value) {
return value;
}
if (value) {
return value;
}

return placeholder;
Expand Down

0 comments on commit aab9a4f

Please sign in to comment.