It's difficult to build decap using node module
I've been trying to run decap from the node module because the bundled React is giving me trouble when I want to use 3rd party components
I hoped I should be able to using esbuild or at least vite to easily build using decap-cms-app but the there exist import from path and stream which are giving me trouble.
How do other do that without too much tooling/orchestration
To Reproduce
-
Install
decap-cms-app -
Install
slate-hyperscriptbecasue #7375 -
Create an
src/index.jswith decap moduleimport CMS from 'decap-cms-app' CMS.init() -
Run esbuild
esbuild --bundle src/index.js --outfile=admin/index.js --log-limit=0 -
See errors
esbuild output
✘ [ERROR] Could not resolve "path" node_modules/decap-cms-backend-bitbucket/dist/esm/API.js:10:20: 10 │ var _path = require("path"); ╵ ~~~~~~ The package "path" wasn't found on the file system but is built into node. Are you trying to bundle for node? You can use "--platform=node" to do that, which will remove this error. ✘ [ERROR] Could not resolve "path" node_modules/decap-cms-backend-azure/dist/esm/API.js:13:20: 13 │ var _path = require("path"); ╵ ~~~~~~ The package "path" wasn't found on the file system but is built into node. Are you trying to bundle for node? You can use "--platform=node" to do that, which will remove this error. ✘ [ERROR] Could not resolve "path" node_modules/decap-cms-backend-test/dist/esm/implementation.js:15:20: 15 │ var _path = require("path"); ╵ ~~~~~~ The package "path" wasn't found on the file system but is built into node. Are you trying to bundle for node? You can use "--platform=node" to do that, which will remove this error. ✘ [ERROR] Could not resolve "path" node_modules/decap-cms-backend-github/dist/esm/API.js:17:20: 17 │ var _path = require("path"); ╵ ~~~~~~ The package "path" wasn't found on the file system but is built into node. Are you trying to bundle for node? You can use "--platform=node" to do that, which will remove this error. ✘ [ERROR] Could not resolve "path" node_modules/decap-cms-backend-gitlab/dist/esm/API.js:19:20: 19 │ var _path = require("path"); ╵ ~~~~~~ The package "path" wasn't found on the file system but is built into node. Are you trying to bundle for node? You can use "--platform=node" to do that, which will remove this error. ✘ [ERROR] Could not resolve "path" node_modules/decap-cms-lib-widgets/dist/esm/stringTemplate.js:19:20: 19 │ var _path = require("path"); ╵ ~~~~~~ The package "path" wasn't found on the file system but is built into node. Are you trying to bundle for node? You can use "--platform=node" to do that, which will remove this error. ✘ [ERROR] Could not resolve "path" node_modules/decap-cms-core/dist/esm/backend.js:20:49: 20 │ import { basename, join, extname, dirname } from 'path'; ╵ ~~~~~~ The package "path" wasn't found on the file system but is built into node. Are you trying to bundle for node? You can use "--platform=node" to do that, which will remove this error. ✘ [ERROR] Could not resolve "path" node_modules/decap-cms-core/dist/esm/reducers/mediaLibrary.js:8:24: 8 │ import { dirname } from 'path'; ╵ ~~~~~~ The package "path" wasn't found on the file system but is built into node. Are you trying to bundle for node? You can use "--platform=node" to do that, which will remove this error. ✘ [ERROR] Could not resolve "path" node_modules/decap-cms-core/dist/esm/reducers/entries.js:13:30: 13 │ import { dirname, join } from 'path'; ╵ ~~~~~~ The package "path" wasn't found on the file system but is built into node. Are you trying to bundle for node? You can use "--platform=node" to do that, which will remove this error. ✘ [ERROR] Could not resolve "path" node_modules/decap-cms-core/dist/esm/reducers/entryDraft.js:4:21: 4 │ import { join } from 'path'; ╵ ~~~~~~ The package "path" wasn't found on the file system but is built into node. Are you trying to bundle for node? You can use "--platform=node" to do that, which will remove this error. ✘ [ERROR] Could not resolve "stream" node_modules/@iarna/toml/parse-stream.js:4:23: 4 │ const stream = require('stream') ╵ ~~~~~~~~ The package "stream" wasn't found on the file system but is built into node. Are you trying to bundle for node? You can use "--platform=node" to do that, which will remove this error. ✘ [ERROR] Could not resolve "path" node_modules/decap-cms-core/dist/esm/components/Collection/NestedCollection.js:14:29: 14 │ import { dirname, sep } from 'path'; ╵ ~~~~~~ The package "path" wasn't found on the file system but is built into node. Are you trying to bundle for node? You can use "--platform=node" to do that, which will remove this error. 12 errors -
Add
esbuild-plugins-node-modules-polyfilland run esbuild from codenode build.jsbuild.js
import { nodeModulesPolyfillPlugin } from 'esbuild-plugins-node-modules-polyfill'; import { build } from 'esbuild'; build({ entryPoints: ['./src/index.js'], outfile: 'admin/index.js', bundle: true, plugins: [ nodeModulesPolyfillPlugin({ modules: { path: true, stream: true, }, }), ], }); -
Run
http-serverto serve -
See browser errors
Error loading the CMS configuration Config Errors: SyntaxError: Unexpected token '=' Check your config.yml file.browser console output
const schema39 = scope.schema[18];const keyword2 = scope.keyword[2];const keyword3 = scope.keyword[3];const wrapper0 = scope.wrapper[0];const wrapper2 = scope.wrapper[1];return function validate23(data, {instancePath="", parentData, parentDataProperty, rootData=data}={}){let vErrors = null;let errors = 0;if(Array.isArray(data)){if(data.length < 1){const err0 = {instancePath,schemaPath:"#/minItems",keyword:"minItems",params:{limit: 1},message:"must NOT have fewer than 1 items"};if(vErrors === null){vErrors = [err0];}else {vErrors.push(err0);}errors++;}const len0 = data.length;for(let i0=0; i0<len0; i0++){let data0 = data[i0];const vSchema0 = data0 && data0.widget;if(vSchema0 === undefined){ = true;}else if((((typeof vSchema0 !== "string") && (!(typeof vSchema0 == "number"))) && (typeof vSchema0 !== "boolean")) && (vSchema0 !== null)){const err1 = {instancePath:instancePath+"/" + i0,schemaPath:"#/items/select",keyword:"select",params:{},message:"\"select\" keyword must be string,number,boolean,null ($data)"};if(vErrors === null){vErrors = [err1];}else {vErrors.push(err1);}errors++; = false;}else {let valid2 = true;if("" + {"str":"value0"} == "unknown"){var _valid0 = true;valid2 = _valid0;}else if("" + {"str":"value0"} == "string"){var _valid0 = true;valid2 = _valid0;}else if("" + {"str":"value0"} == "number"){const _errs3 = errors;if(data0 && typeof data0 == "object" && !Array.isArray(data0)){if(data0.step !== undefined){if(!(typeof data0.step == "number")){const err2 = {instancePath:instancePath+"/" + i0+"/step",schemaPath:"#/items/selectCases/number/properties/step/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err2];}else {vErrors.push(err2);}errors++;}}if(data0.value_type !== undefined){if(typeof data0.value_type !== "string"){const err3 = {instancePath:instancePath+"/" + i0+"/value_type",schemaPath:"#/items/selectCases/number/properties/value_type/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err3];}else {vErrors.push(err3);}errors++;}}if(data0.min !== undefined){if(!(typeof data0.min == "number")){const err4 = {instancePath:instancePath+"/" + i0+"/min",schemaPath:"#/items/selectCases/number/properties/min/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err4];}else {vErrors.push(err4);}errors++;}}if(data0.max !== undefined){if(!(typeof data0.max == "number")){const err5 = {instancePath:instancePath+"/" + i0+"/max",schemaPath:"#/items/selectCases/number/properties/max/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err5];}else {vErrors.push(err5);}errors++;}}}var _valid0 = _errs3 === errors;valid2 = _valid0;}else if("" + {"str":"value0"} == "text"){var _valid0 = true;valid2 = _valid0;}else if("" + {"str":"value0"} == "image"){const _errs12 = errors;if(data0 && typeof data0 == "object" && !Array.isArray(data0)){if(data0.allow_multiple !== undefined){if(typeof data0.allow_multiple !== "boolean"){const err6 = {instancePath:instancePath+"/" + i0+"/allow_multiple",schemaPath:"#/items/selectCases/image/properties/allow_multiple/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"};if(vErrors === null){vErrors = [err6];}else {vErrors.push(err6);}errors++;}}}var _valid0 = _errs12 === errors;valid2 = _valid0;}else if("" + {"str":"value0"} == "file"){const _errs15 = errors;if(data0 && typeof data0 == "object" && !Array.isArray(data0)){if(data0.allow_multiple !== undefined){if(typeof data0.allow_multiple !== "boolean"){const err7 = {instancePath:instancePath+"/" + i0+"/allow_multiple",schemaPath:"#/items/selectCases/file/properties/allow_multiple/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"};if(vErrors === null){vErrors = [err7];}else {vErrors.push(err7);}errors++;}}}var _valid0 = _errs15 === errors;valid2 = _valid0;}else if("" + {"str":"value0"} == "select"){const _errs18 = errors;if(data0 && typeof data0 == "object" && !Array.isArray(data0)){if(data0.options === undefined){const err8 = {instancePath:instancePath+"/" + i0,schemaPath:"#/items/selectCases/select/required",keyword:"required",params:{missingProperty: "options"},message:"must have required property '"+"options"+"'"};if(vErrors === null){vErrors = [err8];}else {vErrors.push(err8);}errors++;}if(data0.multiple !== undefined){if(typeof data0.multiple !== "boolean"){const err9 = {instancePath:instancePath+"/" + i0+"/multiple",schemaPath:"#/items/selectCases/select/properties/multiple/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"};if(vErrors === null){vErrors = [err9];}else {vErrors.push(err9);}errors++;}}if(data0.min !== undefined){let data8 = data0.min;if(!((typeof data8 == "number") && (!(data8 % 1) && !isNaN(data8)))){const err10 = {instancePath:instancePath+"/" + i0+"/min",schemaPath:"#/items/selectCases/select/properties/min/type",keyword:"type",params:{type: "integer"},message:"must be integer"};if(vErrors === null){vErrors = [err10];}else {vErrors.push(err10);}errors++;}}if(data0.max !== undefined){let data9 = data0.max;if(!((typeof data9 == "number") && (!(data9 % 1) && !isNaN(data9)))){const err11 = {instancePath:instancePath+"/" + i0+"/max",schemaPath:"#/items/selectCases/select/properties/max/type",keyword:"type",params:{type: "integer"},message:"must be integer"};if(vErrors === null){vErrors = [err11];}else {vErrors.push(err11);}errors++;}}if(data0.options !== undefined){let data10 = data0.options;if(Array.isArray(data10)){const len1 = data10.length;for(let i1=0; i1<len1; i1++){let data11 = data10[i1];const _errs28 = errors;let valid9 = false;let passing0 = null;const _errs29 = errors;if(typeof data11 !== "string"){const err12 = {instancePath:instancePath+"/" + i0+"/options/" + i1,schemaPath:"#/items/selectCases/select/properties/options/items/oneOf/0/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err12];}else {vErrors.push(err12);}errors++;}var _valid1 = _errs29 === errors;if(_valid1){valid9 = true;passing0 = 0;}const _errs31 = errors;if(!(typeof data11 == "number")){const err13 = {instancePath:instancePath+"/" + i0+"/options/" + i1,schemaPath:"#/items/selectCases/select/properties/options/items/oneOf/1/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err13];}else {vErrors.push(err13);}errors++;}var _valid1 = _errs31 === errors;if(_valid1 && valid9){valid9 = false;passing0 = [passing0, 1];}else {if(_valid1){valid9 = true;passing0 = 1;}const _errs33 = errors;if(data11 && typeof data11 == "object" && !Array.isArray(data11)){if(data11.label === undefined){const err14 = {instancePath:instancePath+"/" + i0+"/options/" + i1,schemaPath:"#/items/selectCases/select/properties/options/items/oneOf/2/required",keyword:"required",params:{missingProperty: "label"},message:"must have required property '"+"label"+"'"};if(vErrors === null){vErrors = [err14];}else {vErrors.push(err14);}errors++;}if(data11.value === undefined){const err15 = {instancePath:instancePath+"/" + i0+"/options/" + i1,schemaPath:"#/items/selectCases/select/properties/options/items/oneOf/2/required",keyword:"required",params:{missingProperty: "value"},message:"must have required property '"+"value"+"'"};if(vErrors === null){vErrors = [err15];}else {vErrors.push(err15);}errors++;}if(data11.label !== undefined){if(typeof data11.label !== "string"){const err16 = {instancePath:instancePath+"/" + i0+"/options/" + i1+"/label",schemaPath:"#/items/selectCases/select/properties/options/items/oneOf/2/properties/label/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err16];}else {vErrors.push(err16);}errors++;}}if(data11.value !== undefined){let data13 = data11.value;const _errs38 = errors;let valid11 = false;let passing1 = null;const _errs39 = errors;if(typeof data13 !== "string"){const err17 = {instancePath:instancePath+"/" + i0+"/options/" + i1+"/value",schemaPath:"#/items/selectCases/select/properties/options/items/oneOf/2/properties/value/oneOf/0/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err17];}else {vErrors.push(err17);}errors++;}var _valid2 = _errs39 === errors;if(_valid2){valid11 = true;passing1 = 0;}const _errs41 = errors;if(!(typeof data13 == "number")){const err18 = {instancePath:instancePath+"/" + i0+"/options/" + i1+"/value",schemaPath:"#/items/selectCases/select/properties/options/items/oneOf/2/properties/value/oneOf/1/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err18];}else {vErrors.push(err18);}errors++;}var _valid2 = _errs41 === errors;if(_valid2 && valid11){valid11 = false;passing1 = [passing1, 1];}else {if(_valid2){valid11 = true;passing1 = 1;}}if(!valid11){const err19 = {instancePath:instancePath+"/" + i0+"/options/" + i1+"/value",schemaPath:"#/items/selectCases/select/properties/options/items/oneOf/2/properties/value/oneOf",keyword:"oneOf",params:{passingSchemas: passing1},message:"must match exactly one schema in oneOf"};if(vErrors === null){vErrors = [err19];}else {vErrors.push(err19);}errors++;}else {errors = _errs38;if(vErrors !== null){if(_errs38){vErrors.length = _errs38;}else {vErrors = null;}}}}}else {const err20 = {instancePath:instancePath+"/" + i0+"/options/" + i1,schemaPath:"#/items/selectCases/select/properties/options/items/oneOf/2/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err20];}else {vErrors.push(err20);}errors++;}var _valid1 = _errs33 === errors;if(_valid1 && valid9){valid9 = false;passing0 = [passing0, 2];}else {if(_valid1){valid9 = true;passing0 = 2;}}}if(!valid9){const err21 = {instancePath:instancePath+"/" + i0+"/options/" + i1,schemaPath:"#/items/selectCases/select/properties/options/items/oneOf",keyword:"oneOf",params:{passingSchemas: passing0},message:"must match exactly one schema in oneOf"};if(vErrors === null){vErrors = [err21];}else {vErrors.push(err21);}errors++;}else {errors = _errs28;if(vErrors !== null){if(_errs28){vErrors.length = _errs28;}else {vErrors = null;}}}}}else {const err22 = {instancePath:instancePath+"/" + i0+"/options",schemaPath:"#/items/selectCases/select/properties/options/type",keyword:"type",params:{type: "array"},message:"must be array"};if(vErrors === null){vErrors = [err22];}else {vErrors.push(err22);}errors++;}}}var _valid0 = _errs18 === errors;valid2 = _valid0;}else if("" + {"str":"value0"} == "markdown"){const _errs43 = errors;if(data0 && typeof data0 == "object" && !Array.isArray(data0)){if(data0.minimal !== undefined){if(typeof data0.minimal !== "boolean"){const err23 = {instancePath:instancePath+"/" + i0+"/minimal",schemaPath:"#/items/selectCases/markdown/properties/minimal/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"};if(vErrors === null){vErrors = [err23];}else {vErrors.push(err23);}errors++;}}if(data0.buttons !== undefined){let data15 = data0.buttons;if(Array.isArray(data15)){const len2 = data15.length;for(let i2=0; i2<len2; i2++){let data16 = data15[i2];if(typeof data16 !== "string"){const err24 = {instancePath:instancePath+"/" + i0+"/buttons/" + i2,schemaPath:"#/items/selectCases/markdown/properties/buttons/items/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err24];}else {vErrors.push(err24);}errors++;}if(!(((((((((((((data16 === "bold") || (data16 === "italic")) || (data16 === "code")) || (data16 === "link")) || (data16 === "heading-one")) || (data16 === "heading-two")) || (data16 === "heading-three")) || (data16 === "heading-four")) || (data16 === "heading-five")) || (data16 === "heading-six")) || (data16 === "quote")) || (data16 === "bulleted-list")) || (data16 === "numbered-list"))){const err25 = {instancePath:instancePath+"/" + i0+"/buttons/" + i2,schemaPath:"#/items/selectCases/markdown/properties/buttons/items/enum",keyword:"enum",params:{allowedValues: schema39.items.selectCases.markdown.properties.buttons.items.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err25];}else {vErrors.push(err25);}errors++;}}}else {const err26 = {instancePath:instancePath+"/" + i0+"/buttons",schemaPath:"#/items/selectCases/markdown/properties/buttons/type",keyword:"type",params:{type: "array"},message:"must be array"};if(vErrors === null){vErrors = [err26];}else {vErrors.push(err26);}errors++;}}if(data0.editor_components !== undefined){let data17 = data0.editor_components;if(Array.isArray(data17)){const len3 = data17.length;for(let i3=0; i3<len3; i3++){if(typeof data17[i3] !== "string"){const err27 = {instancePath:instancePath+"/" + i0+"/editor_components/" + i3,schemaPath:"#/items/selectCases/markdown/properties/editor_components/items/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err27];}else {vErrors.push(err27);}errors++;}}}else {const err28 = {instancePath:instancePath+"/" + i0+"/editor_components",schemaPath:"#/items/selectCases/markdown/properties/editor_components/type",keyword:"type",params:{type: "array"},message:"must be array"};if(vErrors === null){vErrors = [err28];}else {vErrors.push(err28);}errors++;}}if(data0.modes !== undefined){let data19 = data0.modes;if(Array.isArray(data19)){if(data19.length < 1){const err29 = {instancePath:instancePath+"/" + i0+"/modes",schemaPath:"#/items/selectCases/markdown/properties/modes/minItems",keyword:"minItems",params:{limit: 1},message:"must NOT have fewer than 1 items"};if(vErrors === null){vErrors = [err29];}else {vErrors.push(err29);}errors++;}const len4 = data19.length;for(let i4=0; i4<len4; i4++){let data20 = data19[i4];if(typeof data20 !== "string"){const err30 = {instancePath:instancePath+"/" + i0+"/modes/" + i4,schemaPath:"#/items/selectCases/markdown/properties/modes/items/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err30];}else {vErrors.push(err30);}errors++;}if(!((data20 === "raw") || (data20 === "rich_text"))){const err31 = {instancePath:instancePath+"/" + i0+"/modes/" + i4,schemaPath:"#/items/selectCases/markdown/properties/modes/items/enum",keyword:"enum",params:{allowedValues: schema39.items.selectCases.markdown.properties.modes.items.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err31];}else {vErrors.push(err31);}errors++;}}}else {const err32 = {instancePath:instancePath+"/" + i0+"/modes",schemaPath:"#/items/selectCases/markdown/properties/modes/type",keyword:"type",params:{type: "array"},message:"must be array"};if(vErrors === null){vErrors = [err32];}else {vErrors.push(err32);}errors++;}}}var _valid0 = _errs43 === errors;valid2 = _valid0;}else if("" + {"str":"value0"} == "list"){const _errs58 = errors;if(data0 && typeof data0 == "object" && !Array.isArray(data0)){if(data0.allow_add !== undefined){if(typeof data0.allow_add !== "boolean"){const err33 = {instancePath:instancePath+"/" + i0+"/allow_add",schemaPath:"#/items/selectCases/list/properties/allow_add/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"};if(vErrors === null){vErrors = [err33];}else {vErrors.push(err33);}errors++;}}if(data0.collapsed !== undefined){if(typeof data0.collapsed !== "boolean"){const err34 = {instancePath:instancePath+"/" + i0+"/collapsed",schemaPath:"#/items/selectCases/list/properties/collapsed/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"};if(vErrors === null){vErrors = [err34];}else {vErrors.push(err34);}errors++;}}if(data0.summary !== undefined){if(typeof data0.summary !== "string"){const err35 = {instancePath:instancePath+"/" + i0+"/summary",schemaPath:"#/items/selectCases/list/properties/summary/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err35];}else {vErrors.push(err35);}errors++;}}if(data0.minimize_collapsed !== undefined){if(typeof data0.minimize_collapsed !== "boolean"){const err36 = {instancePath:instancePath+"/" + i0+"/minimize_collapsed",schemaPath:"#/items/selectCases/list/properties/minimize_collapsed/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"};if(vErrors === null){vErrors = [err36];}else {vErrors.push(err36);}errors++;}}if(data0.label_singular !== undefined){if(typeof data0.label_singular !== "string"){const err37 = {instancePath:instancePath+"/" + i0+"/label_singular",schemaPath:"#/items/selectCases/list/properties/label_singular/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err37];}else {vErrors.push(err37);}errors++;}}if(data0.i18n !== undefined){if(typeof data0.i18n !== "boolean"){const err38 = {instancePath:instancePath+"/" + i0+"/i18n",schemaPath:"#/items/selectCases/list/properties/i18n/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"};if(vErrors === null){vErrors = [err38];}else {vErrors.push(err38);}errors++;}}if(data0.min !== undefined){if(!(typeof data0.min == "number")){const err39 = {instancePath:instancePath+"/" + i0+"/min",schemaPath:"#/items/selectCases/list/properties/min/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err39];}else {vErrors.push(err39);}errors++;}}if(data0.max !== undefined){if(!(typeof data0.max == "number")){const err40 = {instancePath:instancePath+"/" + i0+"/max",schemaPath:"#/items/selectCases/list/properties/max/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err40];}else {vErrors.push(err40);}errors++;}}}var _valid0 = _errs58 === errors;valid2 = _valid0;}else if("" + {"str":"value0"} == "object"){const _errs75 = errors;if(data0 && typeof data0 == "object" && !Array.isArray(data0)){if(data0.collapsed !== undefined){if(typeof data0.collapsed !== "boolean"){const err41 = {instancePath:instancePath+"/" + i0+"/collapsed",schemaPath:"#/items/selectCases/object/properties/collapsed/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"};if(vErrors === null){vErrors = [err41];}else {vErrors.push(err41);}errors++;}}if(data0.i18n !== undefined){if(typeof data0.i18n !== "boolean"){const err42 = {instancePath:instancePath+"/" + i0+"/i18n",schemaPath:"#/items/selectCases/object/properties/i18n/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"};if(vErrors === null){vErrors = [err42];}else {vErrors.push(err42);}errors++;}}}var _valid0 = _errs75 === errors;valid2 = _valid0;}else if("" + {"str":"value0"} == "relation"){const _errs80 = errors;const _errs81 = errors;let valid21 = false;let passing2 = null;const _errs82 = errors;if(data0 && typeof data0 == "object" && !Array.isArray(data0)){if(data0.collection === undefined){const err43 = {instancePath:instancePath+"/" + i0,schemaPath:"#/items/selectCases/relation/oneOf/0/required",keyword:"required",params:{missingProperty: "collection"},message:"must have required property '"+"collection"+"'"};if(vErrors === null){vErrors = [err43];}else {vErrors.push(err43);}errors++;}if(data0.value_field === undefined){const err44 = {instancePath:instancePath+"/" + i0,schemaPath:"#/items/selectCases/relation/oneOf/0/required",keyword:"required",params:{missingProperty: "value_field"},message:"must have required property '"+"value_field"+"'"};if(vErrors === null){vErrors = [err44];}else {vErrors.push(err44);}errors++;}if(data0.search_fields === undefined){const err45 = {instancePath:instancePath+"/" + i0,schemaPath:"#/items/selectCases/relation/oneOf/0/required",keyword:"required",params:{missingProperty: "search_fields"},message:"must have required property '"+"search_fields"+"'"};if(vErrors === null){vErrors = [err45];}else {vErrors.push(err45);}errors++;}}var _valid3 = _errs82 === errors;if(_valid3){valid21 = true;passing2 = 0;}const _errs83 = errors;if(data0 && typeof data0 == "object" && !Array.isArray(data0)){if(data0.collection === undefined){const err46 = {instancePath:instancePath+"/" + i0,schemaPath:"#/items/selectCases/relation/oneOf/1/required",keyword:"required",params:{missingProperty: "collection"},message:"must have required property '"+"collection"+"'"};if(vErrors === null){vErrors = [err46];}else {vErrors.push(err46);}errors++;}if(data0.valueField === undefined){const err47 = {instancePath:instancePath+"/" + i0,schemaPath:"#/items/selectCases/relation/oneOf/1/required",keyword:"required",params:{missingProperty: "valueField"},message:"must have required property '"+"valueField"+"'"};if(vErrors === null){vErrors = [err47];}else {vErrors.push(err47);}errors++;}if(data0.searchFields === undefined){const err48 = {instancePath:instancePath+"/" + i0,schemaPath:"#/items/selectCases/relation/oneOf/1/required",keyword:"required",params:{missingProperty: "searchFields"},message:"must have required property '"+"searchFields"+"'"};if(vErrors === null){vErrors = [err48];}else {vErrors.push(err48);}errors++;}}var _valid3 = _errs83 === errors;if(_valid3 && valid21){valid21 = false;passing2 = [passing2, 1];}else {if(_valid3){valid21 = true;passing2 = 1;}}if(!valid21){const err49 = {instancePath:instancePath+"/" + i0,schemaPath:"#/items/selectCases/relation/oneOf",keyword:"oneOf",params:{passingSchemas: passing2},message:"must match exactly one schema in oneOf"};if(vErrors === null){vErrors = [err49];}else {vErrors.push(err49);}errors++;}else {errors = _errs81;if(vErrors !== null){if(_errs81){vErrors.length = _errs81;}else {vErrors = null;}}}if(data0 && typeof data0 == "object" && !Array.isArray(data0)){if(data0.collection !== undefined){if(typeof data0.collection !== "string"){const err50 = {instancePath:instancePath+"/" + i0+"/collection",schemaPath:"#/items/selectCases/relation/properties/collection/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err50];}else {vErrors.push(err50);}errors++;}}if(data0.value_field !== undefined){if(typeof data0.value_field !== "string"){const err51 = {instancePath:instancePath+"/" + i0+"/value_field",schemaPath:"#/items/selectCases/relation/properties/value_field/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err51];}else {vErrors.push(err51);}errors++;}}if(data0.search_fields !== undefined){let data33 = data0.search_fields;if(Array.isArray(data33)){if(data33.length < 1){const err52 = {instancePath:instancePath+"/" + i0+"/search_fields",schemaPath:"#/items/selectCases/relation/properties/search_fields/minItems",keyword:"minItems",params:{limit: 1},message:"must NOT have fewer than 1 items"};if(vErrors === null){vErrors = [err52];}else {vErrors.push(err52);}errors++;}const len5 = data33.length;for(let i5=0; i5<len5; i5++){if(typeof data33[i5] !== "string"){const err53 = {instancePath:instancePath+"/" + i0+"/search_fields/" + i5,schemaPath:"#/items/selectCases/relation/properties/search_fields/items/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err53];}else {vErrors.push(err53);}errors++;}}}else {const err54 = {instancePath:instancePath+"/" + i0+"/search_fields",schemaPath:"#/items/selectCases/relation/properties/search_fields/type",keyword:"type",params:{type: "array"},message:"must be array"};if(vErrors === null){vErrors = [err54];}else {vErrors.push(err54);}errors++;}}if(data0.file !== undefined){if(typeof data0.file !== "string"){const err55 = {instancePath:instancePath+"/" + i0+"/file",schemaPath:"#/items/selectCases/relation/properties/file/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err55];}else {vErrors.push(err55);}errors++;}}if(data0.multiple !== undefined){if(typeof data0.multiple !== "boolean"){const err56 = {instancePath:instancePath+"/" + i0+"/multiple",schemaPath:"#/items/selectCases/relation/properties/multiple/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"};if(vErrors === null){vErrors = [err56];}else {vErrors.push(err56);}errors++;}}if(data0.min !== undefined){let data37 = data0.min;if(!((typeof data37 == "number") && (!(data37 % 1) && !isNaN(data37)))){const err57 = {instancePath:instancePath+"/" + i0+"/min",schemaPath:"#/items/selectCases/relation/properties/min/type",keyword:"type",params:{type: "integer"},message:"must be integer"};if(vErrors === null){vErrors = [err57];}else {vErrors.push(err57);}errors++;}}if(data0.max !== undefined){let data38 = data0.max;if(!((typeof data38 == "number") && (!(data38 % 1) && !isNaN(data38)))){const err58 = {instancePath:instancePath+"/" + i0+"/max",schemaPath:"#/items/selectCases/relation/properties/max/type",keyword:"type",params:{type: "integer"},message:"must be integer"};if(vErrors === null){vErrors = [err58];}else {vErrors.push(err58);}errors++;}}if(data0.display_fields !== undefined){let data39 = data0.display_fields;if(Array.isArray(data39)){if(data39.length < 1){const err59 = {instancePath:instancePath+"/" + i0+"/display_fields",schemaPath:"#/items/selectCases/relation/properties/display_fields/minItems",keyword:"minItems",params:{limit: 1},message:"must NOT have fewer than 1 items"};if(vErrors === null){vErrors = [err59];}else {vErrors.push(err59);}errors++;}const len6 = data39.length;for(let i6=0; i6<len6; i6++){if(typeof data39[i6] !== "string"){const err60 = {instancePath:instancePath+"/" + i0+"/display_fields/" + i6,schemaPath:"#/items/selectCases/relation/properties/display_fields/items/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err60];}else {vErrors.push(err60);}errors++;}}}else {const err61 = {instancePath:instancePath+"/" + i0+"/display_fields",schemaPath:"#/items/selectCases/relation/properties/display_fields/type",keyword:"type",params:{type: "array"},message:"must be array"};if(vErrors === null){vErrors = [err61];}else {vErrors.push(err61);}errors++;}}if(data0.options_length !== undefined){let data41 = data0.options_length;if(!((typeof data41 == "number") && (!(data41 % 1) && !isNaN(data41)))){const err62 = {instancePath:instancePath+"/" + i0+"/options_length",schemaPath:"#/items/selectCases/relation/properties/options_length/type",keyword:"type",params:{type: "integer"},message:"must be integer"};if(vErrors === null){vErrors = [err62];}else {vErrors.push(err62);}errors++;}}if(data0.filters !== undefined){let data42 = data0.filters;if(Array.isArray(data42)){const len7 = data42.length;for(let i7=0; i7<len7; i7++){let data43 = data42[i7];if(data43 && typeof data43 == "object" && !Array.isArray(data43)){if(data43.field === undefined){const err63 = {instancePath:instancePath+"/" + i0+"/filters/" + i7,schemaPath:"#/items/selectCases/relation/properties/filters/items/required",keyword:"required",params:{missingProperty: "field"},message:"must have required property '"+"field"+"'"};if(vErrors === null){vErrors = [err63];}else {vErrors.push(err63);}errors++;}if(data43.values === undefined){const err64 = {instancePath:instancePath+"/" + i0+"/filters/" + i7,schemaPath:"#/items/selectCases/relation/properties/filters/items/required",keyword:"required",params:{missingProperty: "values"},message:"must have required property '"+"values"+"'"};if(vErrors === null){vErrors = [err64];}else {vErrors.push(err64);}errors++;}if(data43.field !== undefined){if(typeof data43.field !== "string"){const err65 = {instancePath:instancePath+"/" + i0+"/filters/" + i7+"/field",schemaPath:"#/items/selectCases/relation/properties/filters/items/properties/field/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err65];}else {vErrors.push(err65);}errors++;}}if(data43.values !== undefined){let data45 = data43.values;if(Array.isArray(data45)){if(data45.length < 1){const err66 = {instancePath:instancePath+"/" + i0+"/filters/" + i7+"/values",schemaPath:"#/items/selectCases/relation/properties/filters/items/properties/values/minItems",keyword:"minItems",params:{limit: 1},message:"must NOT have fewer than 1 items"};if(vErrors === null){vErrors = [err66];}else {vErrors.push(err66);}errors++;}const len8 = data45.length;for(let i8=0; i8<len8; i8++){let data46 = data45[i8];if(((typeof data46 !== "string") && (typeof data46 !== "boolean")) && (!((typeof data46 == "number") && (!(data46 % 1) && !isNaN(data46))))){const err67 = {instancePath:instancePath+"/" + i0+"/filters/" + i7+"/values/" + i8,schemaPath:"#/items/selectCases/relation/properties/filters/items/properties/values/items/type",keyword:"type",params:{type: schema39.items.selectCases.relation.properties.filters.items.properties.values.items.type},message:"must be string,boolean,integer"};if(vErrors === null){vErrors = [err67];}else {vErrors.push(err67);}errors++;}}}else {const err68 = {instancePath:instancePath+"/" + i0+"/filters/" + i7+"/values",schemaPath:"#/items/selectCases/relation/properties/filters/items/properties/values/type",keyword:"type",params:{type: "array"},message:"must be array"};if(vErrors === null){vErrors = [err68];}else {vErrors.push(err68);}errors++;}}}else {const err69 = {instancePath:instancePath+"/" + i0+"/filters/" + i7,schemaPath:"#/items/selectCases/relation/properties/filters/items/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err69];}else {vErrors.push(err69);}errors++;}}}else {const err70 = {instancePath:instancePath+"/" + i0+"/filters",schemaPath:"#/items/selectCases/relation/properties/filters/type",keyword:"type",params:{type: "array"},message:"must be array"};if(vErrors === null){vErrors = [err70];}else {vErrors.push(err70);}errors++;}}}var _valid0 = _errs80 === errors;valid2 = _valid0;}else if("" + {"str":"value0"} == "boolean"){var _valid0 = true;valid2 = _valid0;}else if("" + {"str":"value0"} == "map"){const _errs116 = errors;if(data0 && typeof data0 == "object" && !Array.isArray(data0)){if(data0.decimals !== undefined){let data47 = data0.decimals;if(!((typeof data47 == "number") && (!(data47 % 1) && !isNaN(data47)))){const err71 = {instancePath:instancePath+"/" + i0+"/decimals",schemaPath:"#/items/selectCases/map/properties/decimals/type",keyword:"type",params:{type: "integer"},message:"must be integer"};if(vErrors === null){vErrors = [err71];}else {vErrors.push(err71);}errors++;}}if(data0.type !== undefined){let data48 = data0.type;if(typeof data48 !== "string"){const err72 = {instancePath:instancePath+"/" + i0+"/type",schemaPath:"#/items/selectCases/map/properties/type/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err72];}else {vErrors.push(err72);}errors++;}if(!(((data48 === "Point") || (data48 === "LineString")) || (data48 === "Polygon"))){const err73 = {instancePath:instancePath+"/" + i0+"/type",schemaPath:"#/items/selectCases/map/properties/type/enum",keyword:"enum",params:{allowedValues: schema39.items.selectCases.map.properties.type.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err73];}else {vErrors.push(err73);}errors++;}}}var _valid0 = _errs116 === errors;valid2 = _valid0;}else if("" + {"str":"value0"} == "datetime"){const _errs121 = errors;if(data0 && typeof data0 == "object" && !Array.isArray(data0)){if(data0.format !== undefined){if(typeof data0.format !== "string"){const err74 = {instancePath:instancePath+"/" + i0+"/format",schemaPath:"#/items/selectCases/datetime/properties/format/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err74];}else {vErrors.push(err74);}errors++;}}if(data0.date_format !== undefined){let data50 = data0.date_format;const _errs125 = errors;let valid34 = false;let passing3 = null;const _errs126 = errors;if(typeof data50 !== "string"){const err75 = {instancePath:instancePath+"/" + i0+"/date_format",schemaPath:"#/items/selectCases/datetime/properties/date_format/oneOf/0/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err75];}else {vErrors.push(err75);}errors++;}var _valid4 = _errs126 === errors;if(_valid4){valid34 = true;passing3 = 0;}const _errs128 = errors;if(typeof data50 !== "boolean"){const err76 = {instancePath:instancePath+"/" + i0+"/date_format",schemaPath:"#/items/selectCases/datetime/properties/date_format/oneOf/1/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"};if(vErrors === null){vErrors = [err76];}else {vErrors.push(err76);}errors++;}var _valid4 = _errs128 === errors;if(_valid4 && valid34){valid34 = false;passing3 = [passing3, 1];}else {if(_valid4){valid34 = true;passing3 = 1;}}if(!valid34){const err77 = {instancePath:instancePath+"/" + i0+"/date_format",schemaPath:"#/items/selectCases/datetime/properties/date_format/oneOf",keyword:"oneOf",params:{passingSchemas: passing3},message:"must match exactly one schema in oneOf"};if(vErrors === null){vErrors = [err77];}else {vErrors.push(err77);}errors++;}else {errors = _errs125;if(vErrors !== null){if(_errs125){vErrors.length = _errs125;}else {vErrors = null;}}}}if(data0.time_format !== undefined){let data51 = data0.time_format;const _errs131 = errors;let valid35 = false;let passing4 = null;const _errs132 = errors;if(typeof data51 !== "string"){const err78 = {instancePath:instancePath+"/" + i0+"/time_format",schemaPath:"#/items/selectCases/datetime/properties/time_format/oneOf/0/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err78];}else {vErrors.push(err78);}errors++;}var _valid5 = _errs132 === errors;if(_valid5){valid35 = true;passing4 = 0;}const _errs134 = errors;if(typeof data51 !== "boolean"){const err79 = {instancePath:instancePath+"/" + i0+"/time_format",schemaPath:"#/items/selectCases/datetime/properties/time_format/oneOf/1/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"};if(vErrors === null){vErrors = [err79];}else {vErrors.push(err79);}errors++;}var _valid5 = _errs134 === errors;if(_valid5 && valid35){valid35 = false;passing4 = [passing4, 1];}else {if(_valid5){valid35 = true;passing4 = 1;}}if(!valid35){const err80 = {instancePath:instancePath+"/" + i0+"/time_format",schemaPath:"#/items/selectCases/datetime/properties/time_format/oneOf",keyword:"oneOf",params:{passingSchemas: passing4},message:"must match exactly one schema in oneOf"};if(vErrors === null){vErrors = [err80];}else {vErrors.push(err80);}errors++;}else {errors = _errs131;if(vErrors !== null){if(_errs131){vErrors.length = _errs131;}else {vErrors = null;}}}}if(data0.picker_utc !== undefined){if(typeof data0.picker_utc !== "boolean"){const err81 = {instancePath:instancePath+"/" + i0+"/picker_utc",schemaPath:"#/items/selectCases/datetime/properties/picker_utc/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"};if(vErrors === null){vErrors = [err81];}else {vErrors.push(err81);}errors++;}}}var _valid0 = _errs121 === errors;valid2 = _valid0;}else if("" + {"str":"value0"} == "code"){const _errs138 = errors;if(data0 && typeof data0 == "object" && !Array.isArray(data0)){if(data0.default_language !== undefined){if(typeof data0.default_language !== "string"){const err82 = {instancePath:instancePath+"/" + i0+"/default_language",schemaPath:"#/items/selectCases/code/properties/default_language/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err82];}else {vErrors.push(err82);}errors++;}}if(data0.allow_language_selection !== undefined){if(typeof data0.allow_language_selection !== "boolean"){const err83 = {instancePath:instancePath+"/" + i0+"/allow_language_selection",schemaPath:"#/items/selectCases/code/properties/allow_language_selection/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"};if(vErrors === null){vErrors = [err83];}else {vErrors.push(err83);}errors++;}}if(data0.output_code_only !== undefined){if(typeof data0.output_code_only !== "boolean"){const err84 = {instancePath:instancePath+"/" + i0+"/output_code_only",schemaPath:"#/items/selectCases/code/properties/output_code_only/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"};if(vErrors === null){vErrors = [err84];}else {vErrors.push(err84);}errors++;}}if(data0.keys !== undefined){let data56 = data0.keys;if(data56 && typeof data56 == "object" && !Array.isArray(data56)){if(data56.code !== undefined){if(typeof data56.code !== "string"){const err85 = {instancePath:instancePath+"/" + i0+"/keys/code",schemaPath:"#/items/selectCases/code/properties/keys/properties/code/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err85];}else {vErrors.push(err85);}errors++;}}if(data56.lang !== undefined){if(typeof data56.lang !== "string"){const err86 = {instancePath:instancePath+"/" + i0+"/keys/lang",schemaPath:"#/items/selectCases/code/properties/keys/properties/lang/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err86];}else {vErrors.push(err86);}errors++;}}}else {const err87 = {instancePath:instancePath+"/" + i0+"/keys",schemaPath:"#/items/selectCases/code/properties/keys/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err87];}else {vErrors.push(err87);}errors++;}}}var _valid0 = _errs138 === errors;valid2 = _valid0;}else if("" + {"str":"value0"} == "color"){var _valid0 = true;valid2 = _valid0;}if(!valid2){const err88 = {instancePath:instancePath+"/" + i0,schemaPath:"#/items/select",keyword:"select",params:{"_items":["{failingCase: ","\"color\"","}"]},message:{"_items":["\"should match case \\\"color\\\" schema\""]}};if(vErrors === null){vErrors = [err88];}else {vErrors.push(err88);}errors++;}}if(data0 && typeof data0 == "object" && !Array.isArray(data0)){if(data0.name === undefined){const err89 = {instancePath:instancePath+"/" + i0,schemaPath:"#/items/required",keyword:"required",params:{missingProperty: "name"},message:"must have required property '"+"name"+"'"};if(vErrors === null){vErrors = [err89];}else {vErrors.push(err89);}errors++;}if(data0.name !== undefined){if(typeof data0.name !== "string"){const err90 = {instancePath:instancePath+"/" + i0+"/name",schemaPath:"#/items/properties/name/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err90];}else {vErrors.push(err90);}errors++;}}if(data0.label !== undefined){if(typeof data0.label !== "string"){const err91 = {instancePath:instancePath+"/" + i0+"/label",schemaPath:"#/items/properties/label/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err91];}else {vErrors.push(err91);}errors++;}}if(data0.widget !== undefined){if(typeof data0.widget !== "string"){const err92 = {instancePath:instancePath+"/" + i0+"/widget",schemaPath:"#/items/properties/widget/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err92];}else {vErrors.push(err92);}errors++;}}if(data0.required !== undefined){if(typeof data0.required !== "boolean"){const err93 = {instancePath:instancePath+"/" + i0+"/required",schemaPath:"#/items/properties/required/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"};if(vErrors === null){vErrors = [err93];}else {vErrors.push(err93);}errors++;}}if(data0.i18n !== undefined){let data63 = data0.i18n;const _errs161 = errors;let valid39 = false;let passing5 = null;const _errs162 = errors;if(typeof data63 !== "boolean"){const err94 = {instancePath:instancePath+"/" + i0+"/i18n",schemaPath:"#/items/properties/i18n/oneOf/0/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"};if(vErrors === null){vErrors = [err94];}else {vErrors.push(err94);}errors++;}var _valid6 = _errs162 === errors;if(_valid6){valid39 = true;passing5 = 0;}const _errs164 = errors;if(typeof data63 !== "string"){const err95 = {instancePath:instancePath+"/" + i0+"/i18n",schemaPath:"#/items/properties/i18n/oneOf/1/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err95];}else {vErrors.push(err95);}errors++;}if(!(((data63 === "translate") || (data63 === "duplicate")) || (data63 === "none"))){const err96 = {instancePath:instancePath+"/" + i0+"/i18n",schemaPath:"#/items/properties/i18n/oneOf/1/enum",keyword:"enum",params:{allowedValues: schema39.items.properties.i18n.oneOf[1].enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err96];}else {vErrors.push(err96);}errors++;}var _valid6 = _errs164 === errors;if(_valid6 && valid39){valid39 = false;passing5 = [passing5, 1];}else {if(_valid6){valid39 = true;passing5 = 1;}}if(!valid39){const err97 = {instancePath:instancePath+"/" + i0+"/i18n",schemaPath:"#/items/properties/i18n/oneOf",keyword:"oneOf",params:{passingSchemas: passing5},message:"must match exactly one schema in oneOf"};if(vErrors === null){vErrors = [err97];}else {vErrors.push(err97);}errors++;}else {errors = _errs161;if(vErrors !== null){if(_errs161){vErrors.length = _errs161;}else {vErrors = null;}}}}if(data0.hint !== undefined){if(typeof data0.hint !== "string"){const err98 = {instancePath:instancePath+"/" + i0+"/hint",schemaPath:"#/items/properties/hint/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err98];}else {vErrors.push(err98);}errors++;}}if(data0.pattern !== undefined){let data65 = data0.pattern;if(Array.isArray(data65)){if(data65.length < 2){const err99 = {instancePath:instancePath+"/" + i0+"/pattern",schemaPath:"#/items/properties/pattern/minItems",keyword:"minItems",params:{limit: 2},message:"must NOT have fewer than 2 items"};if(vErrors === null){vErrors = [err99];}else {vErrors.push(err99);}errors++;}const len9 = data65.length;if(len9 > 0){let data66 = data65[0];const _errs171 = errors;let valid41 = false;let passing6 = null;const _errs172 = errors;if(typeof data66 !== "string"){const err100 = {instancePath:instancePath+"/" + i0+"/pattern/0",schemaPath:"#/items/properties/pattern/items/0/oneOf/0/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err100];}else {vErrors.push(err100);}errors++;}var _valid7 = _errs172 === errors;if(_valid7){valid41 = true;passing6 = 0;}const _errs174 = errors;const _errs175 = errors;let valid42;keyword2.errors = null;valid42 = keyword2.call(self, data66, {instancePath:instancePath+"/" + i0+"/pattern/0",parentData:data65,parentDataProperty:0,rootData});if(!valid42){if(Array.isArray(keyword2.errors)){vErrors = vErrors === null ? keyword2.errors : vErrors.concat(keyword2.errors);errors = vErrors.length;for(let i9=_errs175; i9<errors; i9++){const err101 = vErrors[i9];if(err101.instancePath === undefined){err101.instancePath = instancePath+"/" + i0+"/pattern/0";}err101.schemaPath = "#/items/properties/pattern/items/0/oneOf/1/instanceof";}}else {const err102 = {instancePath:instancePath+"/" + i0+"/pattern/0",schemaPath:"#/items/properties/pattern/items/0/oneOf/1/instanceof",keyword:"instanceof",params:{},message:"must pass \"instanceof\" keyword validation"};if(vErrors === null){vErrors = [err102];}else {vErrors.push(err102);}errors++;}}var _valid7 = _errs174 === errors;if(_valid7 && valid41){valid41 = false;passing6 = [passing6, 1];}else {if(_valid7){valid41 = true;passing6 = 1;}}if(!valid41){const err103 = {instancePath:instancePath+"/" + i0+"/pattern/0",schemaPath:"#/items/properties/pattern/items/0/oneOf",keyword:"oneOf",params:{passingSchemas: passing6},message:"must match exactly one schema in oneOf"};if(vErrors === null){vErrors = [err103];}else {vErrors.push(err103);}errors++;}else {errors = _errs171;if(vErrors !== null){if(_errs171){vErrors.length = _errs171;}else {vErrors = null;}}}}if(len9 > 1){if(typeof data65[1] !== "string"){const err104 = {instancePath:instancePath+"/" + i0+"/pattern/1",schemaPath:"#/items/properties/pattern/items/1/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err104];}else {vErrors.push(err104);}errors++;}}}else {const err105 = {instancePath:instancePath+"/" + i0+"/pattern",schemaPath:"#/items/properties/pattern/type",keyword:"type",params:{type: "array"},message:"must be array"};if(vErrors === null){vErrors = [err105];}else {vErrors.push(err105);}errors++;}}if(data0.field !== undefined){if(!(wrapper0.validate(data0.field, {instancePath:instancePath+"/" + i0+"/field",parentData:data0,parentDataProperty:"field",rootData}))){vErrors = vErrors === null ? wrapper0.validate.errors : vErrors.concat(wrapper0.validate.errors);errors = vErrors.length;}}if(data0.fields !== undefined){if(!(wrapper2.validate(data0.fields, {instancePath:instancePath+"/" + i0+"/fields",parentData:data0,parentDataProperty:"fields",rootData}))){vErrors = vErrors === null ? wrapper2.validate.errors : vErrors.concat(wrapper2.validate.errors);errors = vErrors.length;}}if(data0.types !== undefined){if(!(wrapper2.validate(data0.types, {instancePath:instancePath+"/" + i0+"/types",parentData:data0,parentDataProperty:"types",rootData}))){vErrors = vErrors === null ? wrapper2.validate.errors : vErrors.concat(wrapper2.validate.errors);errors = vErrors.length;}}}else {const err106 = {instancePath:instancePath+"/" + i0,schemaPath:"#/items/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err106];}else {vErrors.push(err106);}errors++;}}const _errs181 = errors;let valid43;keyword3.errors = null;valid43 = keyword3.call(self, data, {instancePath,parentData,parentDataProperty,rootData});if(!valid43){if(Array.isArray(keyword3.errors)){vErrors = vErrors === null ? keyword3.errors : vErrors.concat(keyword3.errors);errors = vErrors.length;for(let i10=_errs181; i10<errors; i10++){const err107 = vErrors[i10];if(err107.instancePath === undefined){err107.instancePath = instancePath;}err107.schemaPath = "#/uniqueItemProperties";}}else {const err108 = {instancePath,schemaPath:"#/uniqueItemProperties",keyword:"uniqueItemProperties",params:{},message:"must pass \"uniqueItemProperties\" keyword validation"};if(vErrors === null){vErrors = [err108];}else {vErrors.push(err108);}errors++;}}}else {const err109 = {instancePath,schemaPath:"#/type",keyword:"type",params:{type: "array"},message:"must be array"};if(vErrors === null){vErrors = [err109];}else {vErrors.push(err109);}errors++;}validate23.errors = vErrors;return errors === 0;} Uncaught (in promise) SyntaxError: Unexpected token '=' at new Function (<anonymous>) at Ajv.compileSchema (index.js:77024:32) at Ajv.inlineOrCompile (index.js:77080:51) at Ajv.resolveRef (index.js:77074:50) at Object.code (index.js:78859:49) at keywordCode (index.js:76854:15) at index.js:76580:27 at CodeGen.code (index.js:74885:13) at CodeGen.block (index.js:75012:18) at schemaKeywords (index.js:76580:15) -
Try vite with
vite.config.js
import { nodePolyfills } from 'vite-plugin-node-polyfills' import {defineConfig} from "vite"; import {viteStaticCopy} from "vite-plugin-static-copy"; export default defineConfig({ build: { rollupOptions: { input: 'admin/index.html', }, }, plugins: [ nodePolyfills(), viteStaticCopy({ targets: [ { src: 'admin/config.yml', dest: 'admin/config.yml' } ] }) ], }) -
Same runtime error
Expected behavior
Decap is a frontend app, I expect it to bundle without issues. I'd even expect it to run build-less with @web/dev-server...
Applicable Versions:
- Decap CMS version: 3.6.4
- OS: macOS 15.5
- Browser version: Brave 1.79.119 (Official Build) (x86_64) Chromium: 137.0.7151.68
- Node.JS version: v20.17.0
Additional context
@tpluscode please be more specific
More specific how? node dependencies in decap codebase make bundling and running ESM decap in browser problematic.
(I typed node but I meant path - edited now)
Also, when I tried to use node polyfills in both vite and esbuild I then got these errore in runtime
Error compiling schema, function code: const schema39 = /* ... */
at /* a long stack trace */
Uncaught (in promise) SyntaxError: Unexpected token '='
at new Function (<anonymous>)
at Ajv.compileSchema (index.js:77024:32)
at Ajv.inlineOrCompile (index.js:77080:51)
at Ajv.resolveRef (index.js:77074:50)
at Object.code (index.js:78859:49)
at keywordCode (index.js:76854:15)
at index.js:76580:27
at CodeGen.code (index.js:74885:13)
at CodeGen.block (index.js:75012:18)
at schemaKeywords (index.js:76580:15)
Specific: provide all the steps required to reproduce your issue. Print all errors that you encountered. Write workarounds that you considered. You should follow the issue template.
Fine, I edited the issue description. But you will not find anything which I did not already mention
I also tried to keep the CDNed decap and use react-bootstrap-typeahead in a custom widget:
Warning: Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:
1. You might have mismatching versions of React and the renderer (such as React DOM)
2. You might be breaking the Rules of Hooks
3. You might have more than one copy of React in the same app
See https://reactjs.org/link/invalid-hook-call for tips about how to debug and fix this problem.
TypeError: Cannot read properties of null (reading 'useRef')
at useRef10 (index.js:1097:31)
at useAsync (index.js:25568:45)
at index.js:29165:98
at Ea (react-dom.production.min.js:167:137)
at xs (react-dom.production.min.js:193:57)
at El (react-dom.production.min.js:294:275)
at wu (react-dom.production.min.js:280:389)
at yu (react-dom.production.min.js:280:320)
at vu (react-dom.production.min.js:280:180)
at ou (react-dom.production.min.js:268:209)
I tried to force a single version of react and react-dom with overrides in package.json but it does not help
"overrides": {
"react": "^18.3.1",
"react-dom": "^18.3.1"
}
@tpluscode We plan to release a new minor version on Thursday, which includes React 19 and other dependency updates. It's already merged to main, we are testing it ATM. I suspect it will also help with your issue.
Just in time for me. Perfect! Let's see on Thursday
@tpluscode decap-cms is now at version 3.7.0, can you try again please?
I just tried to build with esbuild. It still requires the node polyfills for path and stream which is a bit of PITA. Additionally, this:
✘ [ERROR] No matching export in "node_modules/minimatch/dist/esm/index.js" for import "default"
node_modules/decap-cms-backend-bitbucket/dist/esm/git-lfs-client.js:1:7:
1 │ import minimatch from 'minimatch';
│ ~~~~~~~~~
╵ defaults
Did you mean to import "defaults" instead?
node_modules/minimatch/dist/esm/index.js:96:13:
96 │ export const defaults = (def) => {
╵ ~~~~~~~~
/Users/tplus/projects/zazuko/decap-i18n/node_modules/esbuild/lib/main.js:1463
let error = new Error(text);
^
Error: Build failed with 1 error:
node_modules/decap-cms-backend-bitbucket/dist/esm/git-lfs-client.js:1:7: ERROR: No matching export in "node_modules/minimatch/dist/esm/index.js" for import "default"
at failureErrorWithLog (/Users/tplus/projects/zazuko/decap-i18n/node_modules/esbuild/lib/main.js:1463:15)
at /Users/tplus/projects/zazuko/decap-i18n/node_modules/esbuild/lib/main.js:924:25
at /Users/tplus/projects/zazuko/decap-i18n/node_modules/esbuild/lib/main.js:1341:9
at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
errors: [Getter/Setter],
warnings: [Getter/Setter]
}
Node.js v20.17.0
You need a named import in decap-cms-backend-bitbucket
diff --git a/node_modules/decap-cms-backend-bitbucket/dist/esm/git-lfs-client.js b/node_modules/decap-cms-backend-bitbucket/dist/esm/git-lfs-client.js
index 1b01a52..9489c01 100644
--- a/node_modules/decap-cms-backend-bitbucket/dist/esm/git-lfs-client.js
+++ b/node_modules/decap-cms-backend-bitbucket/dist/esm/git-lfs-client.js
@@ -1,4 +1,4 @@
-import minimatch from 'minimatch';
+import { minimatch } from 'minimatch';
import { unsentRequest } from 'decap-cms-lib-util';
export class GitLfsClient {
static defaultContentHeaders = {
With this patch in the build completes but unfortunately, the app does not load completely (empty titles on collection list, no content in editor widgets). Here's the console output
Warning: Failed prop type: Invalid prop `children` supplied to `ErrorBoundary`, expected a ReactNode.
Warning: Failed prop type: Invalid prop `children` supplied to `Modal`, expected a ReactNode.
index.js:167593 ReferenceError: Buffer is not defined
at exports8.toBuffer (index.js:61607:44)
at module2.exports (index.js:61776:42)
at matter2 (index.js:61827:20)
at FrontmatterFormatter.fromFile (index.js:160556:54)
at apply3 (index.js:30282:25)
at index.js:30462:18
at apply3 (index.js:30286:25)
at index.js:30314:18
at index.js:167592:62
at Array.map (<anonymous>)
Adding buffer to node polyfill did not help. Let me try vite
Vite in dev mode show the same runtime error.
Interestingly, in production build only the two react errors remain and default functionality works but I still get No control for widget I registered using CMS.registerWidget
No wait, my mistake. With vite I inadvertently built from the esbuild output and not the actual source :)
So final verdict is that plain esbuild does not work but vite does, with caveats:
-
minimachimport indecap-cms-backend-bitbucketmust be patched - node polyfill is required (I used
vite-plugin-node-polyfills) -
Failed prop type: Invalid prop childrenappear in vite dev mode but I have not yet noticed any issues that should cause
I think PR #7395 addresses the issue. Once tests pass, I will release a patch.
Is the Failed prop type related? Strange I only see it with esbuild and dev-mode vite
@tpluscode I released a patch - v3.7.2. I'm sorry it took so long, I was battling with CI. Can you test, please?
I'm experiencing the same issue as @tpluscode, currently using Decap-CMS-App version 3.8.3 and still encountering the same error.