@teambit/webpack.modules.config-mutator
Advanced tools
Comparing version 0.0.167 to 0.0.168
@@ -339,5 +339,5 @@ import { isObject, omit } from 'lodash'; | ||
htmlPlugins.forEach((htmlPlugin) => { | ||
if(htmlPlugin.userOptions !== undefined) { | ||
htmlPlugin.options.templateContent = htmlPlugin.userOptions.templateContent | ||
} | ||
if (htmlPlugin.userOptions !== undefined && htmlPlugin.userOptions?.templateContent !== undefined) { | ||
if (htmlPlugin.options) htmlPlugin.options.templateContent = htmlPlugin.userOptions.templateContent; | ||
} | ||
@@ -351,4 +351,4 @@ const htmlContent = | ||
htmlPlugin.options.templateContent = newHtmlContent; | ||
htmlPlugin.userOptions.templateContent = newHtmlContent | ||
if (htmlPlugin.options) htmlPlugin.options.templateContent = newHtmlContent; | ||
htmlPlugin.userOptions.templateContent = newHtmlContent; | ||
}); | ||
@@ -381,5 +381,5 @@ } | ||
? htmlPlugin.options?.templateContent({}) | ||
: htmlPlugin.options.templateContent; | ||
: htmlPlugin.options?.templateContent; | ||
htmlPlugin.options.templateContent = (htmlContent as string).replace(element, ''); | ||
if (htmlPlugin.options) htmlPlugin.options.templateContent = (htmlContent as string).replace(element, ''); | ||
@@ -386,0 +386,0 @@ this.raw.plugins = this.raw.plugins.map((plugin) => { |
@@ -306,11 +306,13 @@ "use strict"; | ||
htmlPlugins.forEach((htmlPlugin) => { | ||
var _a, _b, _c; | ||
if (htmlPlugin.userOptions !== undefined) { | ||
htmlPlugin.options.templateContent = htmlPlugin.userOptions.templateContent; | ||
var _a, _b, _c, _d; | ||
if (htmlPlugin.userOptions !== undefined && ((_a = htmlPlugin.userOptions) === null || _a === void 0 ? void 0 : _a.templateContent) !== undefined) { | ||
if (htmlPlugin.options) | ||
htmlPlugin.options.templateContent = htmlPlugin.userOptions.templateContent; | ||
} | ||
const htmlContent = typeof ((_a = htmlPlugin.options) === null || _a === void 0 ? void 0 : _a.templateContent) === 'function' | ||
? (_b = htmlPlugin.options) === null || _b === void 0 ? void 0 : _b.templateContent({}) | ||
: (_c = htmlPlugin.options) === null || _c === void 0 ? void 0 : _c.templateContent; | ||
const htmlContent = typeof ((_b = htmlPlugin.options) === null || _b === void 0 ? void 0 : _b.templateContent) === 'function' | ||
? (_c = htmlPlugin.options) === null || _c === void 0 ? void 0 : _c.templateContent({}) | ||
: (_d = htmlPlugin.options) === null || _d === void 0 ? void 0 : _d.templateContent; | ||
const newHtmlContent = (0, html_modules_inject_html_element_1.inject)(htmlContent, element); | ||
htmlPlugin.options.templateContent = newHtmlContent; | ||
if (htmlPlugin.options) | ||
htmlPlugin.options.templateContent = newHtmlContent; | ||
htmlPlugin.userOptions.templateContent = newHtmlContent; | ||
@@ -330,3 +332,3 @@ }); | ||
removeElementFromHtmlTemplate(element) { | ||
var _a, _b, _c, _d; | ||
var _a, _b, _c, _d, _e; | ||
if (!this.raw.plugins) { | ||
@@ -339,4 +341,5 @@ this.raw.plugins = []; | ||
? (_d = htmlPlugin.options) === null || _d === void 0 ? void 0 : _d.templateContent({}) | ||
: htmlPlugin.options.templateContent; | ||
htmlPlugin.options.templateContent = htmlContent.replace(element, ''); | ||
: (_e = htmlPlugin.options) === null || _e === void 0 ? void 0 : _e.templateContent; | ||
if (htmlPlugin.options) | ||
htmlPlugin.options.templateContent = htmlContent.replace(element, ''); | ||
this.raw.plugins = this.raw.plugins.map((plugin) => { | ||
@@ -343,0 +346,0 @@ if (plugin.constructor.name === 'HtmlWebpackPlugin') { |
{ | ||
"name": "@teambit/webpack.modules.config-mutator", | ||
"version": "0.0.167", | ||
"version": "0.0.168", | ||
"homepage": "https://bit.cloud/teambit/webpack/modules/config-mutator", | ||
@@ -9,8 +9,8 @@ "main": "dist/index.js", | ||
"name": "modules/config-mutator", | ||
"version": "0.0.167" | ||
"version": "0.0.168" | ||
}, | ||
"dependencies": { | ||
"html-webpack-plugin": "5.3.2", | ||
"lodash": "4.17.21", | ||
"webpack-merge": "5.8.0", | ||
"html-webpack-plugin": "5.3.2", | ||
"webpack": "5.84.1", | ||
@@ -17,0 +17,0 @@ "@teambit/html.modules.inject-html-element": "0.0.5" |
Sorry, the diff of this file is not supported yet
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
1
57049
1148