During a Jenkins build, I am getting the following errors:
Bundler: Begin processing bundleconfig.json
/src/Vizualization/wwwroot/js/datatables-knockout-binding.min.js(29,21,29,21): Bundler & Minifier error 0: Expected '}': ... [/src/Vizualization/Vizualization.csproj]
/src/Vizualization/wwwroot/js/datatables-knockout-binding.min.js(32,33,32,33): Bundler & Minifier error 0: Expected ';' [/src/Vizualization/Vizualization.csproj]
/src/Vizualization/wwwroot/js/datatables-knockout-binding.min.js(32,33,32,33): Bundler & Minifier error 0: Expected expression: : [/src/Vizualization/Vizualization.csproj]
/src/Vizualization/wwwroot/js/datatables-knockout-binding.min.js(46,14,46,14): Bundler & Minifier error 0: Expected '}': ; [/src/Vizualization/Vizualization.csproj]
/src/Vizualization/wwwroot/js/datatables-knockout-binding.min.js(61,5,61,5): Bundler & Minifier error 0: Expected ')': } [/src/Vizualization/Vizualization.csproj]
/src/Vizualization/wwwroot/js/datatables-knockout-binding.min.js(61,6,61,6): Bundler & Minifier error 0: Expected ')': ; [/src/Vizualization/Vizualization.csproj]
/src/Vizualization/wwwroot/js/datatables-knockout-binding.min.js(62,1,62,1): Bundler & Minifier error 0: Syntax error: } [/src/Vizualization/Vizualization.csproj]
/src/Vizualization/wwwroot/js/datatables-knockout-binding.min.js(62,2,62,2): Bundler & Minifier error 0: Expected expression: ) [/src/Vizualization/Vizualization.csproj]
/src/Vizualization/wwwroot/js/datatables-knockout-binding.min.js(62,3,62,3): Bundler & Minifier error 0: Expected expression: ) [/src/Vizualization/Vizualization.csproj]
Bundler: Done processing bundleconfig.json
I do not get this when I build locally. Each are triggered by dotnet build "Vizualization.csproj" -c Release -o /app/build
I've looked over the code and do not see any mismatched curly braces. Because of this and the fact that I cannot reproduce it locally, the MRE is the file, but it is small (see source of datatables-knockout-binding.min.js below)
(function (factory) {
if (typeof require === "function" && typeof exports === "object" && typeof module === "object") {
factory(require("jquery"), require("knockout"));
}
else if (typeof define === "function" && define["amd"]) {
define(["jquery", "knockout"], factory);
}
else {
factory($, ko);
}
}(function ($, ko) {
function getOptions(allBindings) {
return allBindings.get("tableOptions") || {};
}
ko.bindingHandlers.datatable = {
init: function (element, valueAccessor, allBindings, viewModel, bindingContext) {
const data = valueAccessor();
const update = () => {
const oldTable = $(element).closest("table").DataTable();
const pageInfo = oldTable.page.info();
const page = pageInfo.page;
const pageLength = pageInfo.length;
const order = oldTable.order();
const search = oldTable.search();
oldTable.destroy();
ko.bindingHandlers.foreach.update(element, valueAccessor, allBindings, viewModel, bindingContext);
const tableOptions = {
...getOptions(allBindings),
order,
pageLength,
deferLoading: true
};
if (tableOptions.search) {
tableOptions.search.search = search;
}
else {
tableOptions.search = { search };
}
$(element).closest("table")
.DataTable(tableOptions)
.page(page)
.draw();
};
data.subscribe(update, null, "arrayChange");
ko.utils.arrayForEach(element.childNodes, function (node) {
if (node && node.nodeType !== 1 /*element*/) {
node.parentNode.removeChild(node);
}
});
ko.bindingHandlers.foreach.init(element, valueAccessor, allBindings, viewModel, bindingContext);
ko.bindingHandlers.foreach.update(element, valueAccessor, allBindings, viewModel, bindingContext);
const tableOptions = getOptions(allBindings);
$(element).closest("table").DataTable(tableOptions);
return { controlsDescendantBindings: true };
}
};
}));