Build error with @arcgis/core and Angular 11: "Module parse failed: Unexpected token"

6667
13
07-01-2022 06:36 AM
turbolego
New Contributor II

Build error using @arcgis/core with Angular 11:

Error: ./node_modules/@arcgis/core/core/has.js 5:101
Module parse failed: Unexpected token (5:101)
File was processed with these loaders:
 * ./node_modules/@angular-devkit/build-angular/src/babel/webpack-loader.js
 * ./node_modules/@ngtools/webpack/src/ivy/index.js
You may need an additional loader to handle the result of these loaders.
| See https://js.arcgis.com/4.24/esri/copyright.txt for details.
| */
> let e;function a(a){return"function"==typeof e[a]?e[a]=e[a](globalThis):e[a]}e=globalThis.dojoConfig?.has||globalThis.esriConfig?.has?{...globalThis.dojoConfig?.has,...globalThis.esriConfig?.has}:{},a.add=(d,o,r,i)=>((i||void 0===e[d])&&(e[d]=o),r&&a(d)),a.cache=e,a.add("esri-deprecation-warnings",!0),(()=>{a.add("host-webworker",void 0!==globalThis.WorkerGlobalScope&&self instanceof globalThis.WorkerGlobalScope);const e="undefined"!=typeof window&&"undefined"!=typeof location&&"undefined"!=typeof document&&window.location===location&&window.document===document;if(a.add("host-browser",e),a.add("host-node","object"==typeof globalThis.process&&globalThis.process.versions?.node&&globalThis.process.versions.v8),a.add("dom",e),a("host-browser")){const e=navigator,d=e.userAgent,o=e.appVersion,r=parseFloat(o);if(a.add("wp",parseFloat(d.split("Windows Phone")[1])||void 0),a.add("msapp",parseFloat(d.split("MSAppHost/")[1])||void 0),a.add("khtml",o.includes("Konqueror")?r:void 0),a.add("edge",parseFloat(d.split("Edge/")[1])||void 0),a.add("opr",parseFloat(d.split("OPR/")[1])||void 0),a.add("webkit",!a("wp")&&!a("edge")&&parseFloat(d.split("WebKit/")[1])||void 0),a.add("chrome",!a("edge")&&!a("opr")&&parseFloat(d.split("Chrome/")[1])||void 0),a.add("android",!a("wp")&&parseFloat(d.split("Android ")[1])||void 0),a.add("safari",!o.includes("Safari")||a("wp")||a("chrome")||a("android")||a("edge")||a("opr")?void 0:parseFloat(o.split("Version/")[1])),a.add("mac",o.includes("Macintosh")),!a("wp")&&d.match(/(iPhone|iPod|iPad)/)){const e=RegExp.$1.replace(/P/,"p"),o=d.match(/OS ([\d_]+)/)?RegExp.$1:"1",r=parseFloat(o.replace(/_/,".").replace(/_/g,""));a.add(e,r),a.add("ios",r)}a.add("trident",parseFloat(o.split("Trident/")[1])||void 0),a("webkit")||(!d.includes("Gecko")||a("wp")||a("khtml")||a("trident")||a("edge")||a.add("mozilla",r),a("mozilla")&&a.add("ff",parseFloat(d.split("Firefox/")[1]||d.split("Minefield/")[1])||void 0))}})(),(()=>{if(globalThis.navigator){const e=navigator.userAgent,d=/Android|webOS|iPhone|iPad|iPod|BlackBerry|Opera Mini|IEMobile/i.test(e),o=/iPhone/i.test(e);d&&a.add("esri-mobile",d),o&&a.add("esri-iPhone",o),a.add("esri-geolocation",!!navigator.geolocation)}a.add("esri-canvas-svg-support",!a("trident")),a.add("esri-wasm","WebAssembly"in globalThis),a.add("esri-shared-array-buffer",(()=>{const e="SharedArrayBuffer"in globalThis,a=!1===globalThis.crossOriginIsolated;return e&&!a})),a.add("wasm-simd",(()=>{const e=[0,97,115,109,1,0,0,0,1,5,1,96,0,1,123,3,2,1,0,10,10,1,8,0,65,0,253,15,253,98,11];return WebAssembly.validate(new Uint8Array(e))})),a.add("esri-atomics","Atomics"in globalThis),a.add("esri-workers","Worker"in globalThis),a.add("web-feat:cache","caches"in globalThis),a.add("esri-workers-arraybuffer-transfer",!a("safari")||Number(a("safari"))>=12),a.add("featurelayer-simplify-thresholds",[.5,.5,.5,.5]),a.add("featurelayer-simplify-payload-size-factors",[1,1,4]),a.add("featurelayer-snapshot-enabled",!0),a.add("featurelayer-snapshot-point-min-threshold",8e4),a.add("featurelayer-snapshot-point-max-threshold",4e5),a.add("featurelayer-snapshot-point-coverage",.1),a.add("featurelayer-advanced-symbols",!1),a.add("featurelayer-pbf",!0),a.add("featurelayer-pbf-statistics",!1),a.add("feature-layers-workers",!0),a.add("feature-polyline-generalization-factor",1),a.add("mapview-transitions-duration",200),a.add("mapview-srswitch-adjust-rotation-scale-threshold",24e6),a.add("mapserver-pbf-enabled",!1),a.add("mapimagelayer-popup-identify-max-tolerance",20),a.add("heatmap-allow-raster-fallback",!0),a.add("heatmap-force-raster",!1),a("host-webworker")||a("host-browser")&&(a.add("esri-csp-restrictions",(()=>{try{new Function}catch{return!0}return!1})),a.add("esri-image-decode",(()=>{if("decode"in new Image){const e=new Image;return e.src='data&colon;image/svg+xml;charset=UTF-8,<svg version="1.1" xmlns="http://www.w3.org/2000/svg"></svg>',void e.decode().then((()=>{a.add("esri-image-decode",!0,!0,!0)})).catch((()=>{a.add("esri-image-decode",!1,!0,!0)}))}return!1})),a.add("esri-url-encodes-apostrophe",(()=>{const e=window.document.createElement("a");return e.href="?'",e.href.includes("?%27")})))})();export{a as default};
|
 @ ./node_modules/@arcgis/core/geometry/Geometry.js 5:200-223
 @ ./node_modules/@arcgis/core/geometry/Polygon.js
 @ ./src/app/features/header/title/senterlinje/senterlinje.component.ts
 @ ./src/app/app.module.ts
 @ ./src/main.ts
 @ multi ./src/main.ts

Error: ./node_modules/@arcgis/core/config.js 5:125
Module parse failed: Unexpected token (5:125)
File was processed with these loaders:
 * ./node_modules/@angular-devkit/build-angular/src/babel/webpack-loader.js
 * ./node_modules/@ngtools/webpack/src/ivy/index.js
You may need an additional loader to handle the result of these loaders.
| See https://js.arcgis.com/4.24/esri/copyright.txt for details.
| */
> import"./core/has.js";import{deepMerge as e}from"./core/object.js";const r={apiKey:void 0,applicationUrl:globalThis.location?.href,assetsPath:"",fontsUrl:"https://static.arcgis.com/fonts",geometryServiceUrl:"https://utility.arcgisonline.com/arcgis/rest/services/Geometry/GeometryServer",geoRSSServiceUrl:"https://utility.arcgis.com/sharing/rss",kmlServiceUrl:"https://utility.arcgis.com/sharing/kml",portalUrl:"https://www.arcgis.com",routeServiceUrl:"https://route-api.arcgis.com/arcgis/rest/services/World/Route/NAServer/Route_World",workers:{loaderConfig:{has:{},paths:{},map:{},packages:[]}},request:{crossOriginNoCorsDomains:null,httpsDomains:["arcgis.com","arcgisonline.com","esrikr.com","premiumservices.blackbridge.com","esripremium.accuweather.com","gbm.digitalglobe.com","firstlook.digitalglobe.com","msi.digitalglobe.com"],interceptors:[],maxUrlLength:2e3,priority:"high",proxyRules:[],proxyUrl:null,timeout:6e4,trustedServers:[],useIdentity:!0},log:{interceptors:[],level:null}};if(globalThis.esriConfig&&(e(r,globalThis.esriConfig,!0),delete r.has),!r.assetsPath){const e="4.24.5";r.assetsPath=`https://js.arcgis.com/${e.slice(0,-2)}/@arcgis/core/assets`}r.baseUrl&&console.warn("[esri.config]","baseUrl has been replaced by assetsPath"),Object.defineProperty(r,"baseUrl",{set(){console.warn("[esri.config]","baseUrl has been replaced by assetsPath")}}),r.request.corsEnabledServers=[],r.request.corsEnabledServers.push=function(){return console.warn("[esri.config]","request.corsEnabledServers is not supported and will be removed in a future release. See http://esriurl.com/cors8664"),0};export{r as default};
|
 @ ./node_modules/@arcgis/core/core/Logger.js 5:0-28 5:1704-1705 5:2048-2049 5:2060-2061
 @ ./node_modules/@arcgis/core/geometry/Point.js
 @ ./node_modules/@arcgis/core/geometry/Polygon.js
 @ ./src/app/features/header/title/senterlinje/senterlinje.component.ts
 @ ./src/app/app.module.ts
 @ ./src/main.ts
 @ multi ./src/main.ts

Error: ./node_modules/@arcgis/core/core/accessorSupport/tracking.js 5:1286
Module parse failed: Unexpected token (5:1286)
File was processed with these loaders:
 * ./node_modules/@angular-devkit/build-angular/src/babel/webpack-loader.js
 * ./node_modules/@ngtools/webpack/src/ivy/index.js
You may need an additional loader to handle the result of these loaders.
| See https://js.arcgis.com/4.24/esri/copyright.txt for details.
| */
> import"../has.js";import t from"../Logger.js";import{pathToArray as n,getProperties as r}from"./utils.js";import{Flags as e}from"./tracking/Flags.js";let o,i=[];const c=t.getLogger("esri.core.Accessor");function s(){i=[]}function l(t){void 0!==o&&o.onObservableAccessed(t)}let a=!1,f=!1;function g(t,n,r){if(a)return p(t,n,r);d(t);const e=n.call(r);return m(),e}function u(t,n){return g(void 0,t,n)}function p(t,n,r){const e=a;a=!0,d(t);let o=null;try{o=n.call(r)}catch(i){f&&c.error(i)}return m(),a=e,o}function d(t){o=t,i.push(t)}function m(){const t=i.pop();o=i.length>0?i[i.length-1]:void 0,void 0!==t&&t.onTrackingEnd()}function y(t,n){if(n.flags&e.DepTrackingInitialized)return;const r=f;f=!1,n.flags&e.AutoTracked?p(n,n.metadata.get,t):h(t,n),f=r}const A=[];function h(t,r){r.flags&e.ExplicitlyTracking||(r.flags|=e.ExplicitlyTracking,p(r,(()=>{const e=r.metadata.dependsOn||A;for(const r of e)if("string"!=typeof r||r.includes(".")){const e=n(r);for(let n=0,r=t;n<e.length&&null!=r&&"object"==typeof r;++n)r=k(r,e[n],n!==e.length-1)}else k(t,r,!1)})),r.flags&=~e.ExplicitlyTracking)}function k(t,n,e){const o="?"===n[n.length-1]?n.slice(0,-1):n;if(null!=t.getItemAt||Array.isArray(t)){const n=parseInt(o,10);if(!isNaN(n))return Array.isArray(t)?t[n]:t.getItemAt(n)}const i=r(t)?.properties.get(o);return i&&(l(i),y(t,i)),e?t[o]:void 0}export{y as initializeDependencyTracking,s as resetGlobalTarget,g as runTracked,p as runTrackedNoThrow,u as runUntracked,l as trackAccess,h as trackExplicitDependencies};
|
 @ ./node_modules/@arcgis/core/core/accessorSupport/decorators/subclass.js 5:119-164 5:1223-1224
 @ ./node_modules/@arcgis/core/geometry/Polygon.js
 @ ./src/app/features/header/title/senterlinje/senterlinje.component.ts
 @ ./src/app/app.module.ts
 @ ./src/main.ts
 @ multi ./src/main.ts

Error: ./node_modules/@arcgis/core/core/accessorSupport/read.js 5:1482
Module parse failed: Unexpected token (5:1482)
File was processed with these loaders:
 * ./node_modules/@angular-devkit/build-angular/src/babel/webpack-loader.js
 * ./node_modules/@ngtools/webpack/src/ivy/index.js
You may need an additional loader to handle the result of these loaders.
| See https://js.arcgis.com/4.24/esri/copyright.txt for details.
| */
> import{valueOf as e,exists as t}from"./get.js";import{getProperties as r}from"./utils.js";import{originSpecificReadPropertyDefinition as n,originSpecificPropertyDefinition as o}from"./extensions/serializableProperty.js";function s(e,r,n){if(!e||!e.read||!1===e.read.enabled||!e.read.source)return!1;const o=e.read.source;if("string"==typeof o){if(o===r)return!0;if(o.includes(".")&&0===o.indexOf(r)&&t(o,n))return!0}else for(const s of o){if(s===r)return!0;if(s.includes(".")&&0===s.indexOf(r)&&t(s,n))return!0}return!1}function i(e){return e&&(!e.read||!1!==e.read.enabled&&!e.read.source)}function a(e,t,r,o,a){let f=n(t[r],a);i(f)&&(e[r]=!0);for(const i of Object.getOwnPropertyNames(t))f=n(t[i],a),s(f,r,o)&&(e[i]=!0)}function f(e,t,r,n){const s=r.metadatas,i=o(s[t],"any",n),a=i&&i.default;if(void 0===a)return;const f="function"==typeof a?a.call(e,t,n):a;void 0!==f&&r.set(t,f)}const c={origin:"service"};function u(t,o,s=c){if(!o||"object"!=typeof o)return;const i=r(t),u=i.metadatas,d={};for(const e of Object.getOwnPropertyNames(o))a(d,u,e,o,s);i.setDefaultOrigin(s.origin);for(const r of Object.getOwnPropertyNames(d)){const a=n(u[r],s).read,f=a&&a.source;let c;c=f&&"string"==typeof f?e(o,f):o[r],a&&a.reader&&(c=a.reader.call(t,c,o,s)),void 0!==c&&i.set(r,c)}if(!s||!s.ignoreDefaults){i.setDefaultOrigin("defaults");for(const e of Object.getOwnPropertyNames(u))d[e]||f(t,e,i,s)}i.setDefaultOrigin("user")}function d(e,t,r,n=c){const o={...n,messages:[]};r(o),o.messages?.forEach((t=>{"warning"!==t.type||e.loaded?n&&n.messages&&n.messages.push(t):e.loadWarnings.push(t)}))}export{u as read,d as readLoadable};
|
 @ ./node_modules/@arcgis/core/core/JSONSupport.js 5:265-314 5:622-623
 @ ./node_modules/@arcgis/core/geometry/SpatialReference.js
 @ ./node_modules/@arcgis/core/geometry/Polygon.js
 @ ./src/app/features/header/title/senterlinje/senterlinje.component.ts
 @ ./src/app/app.module.ts
 @ ./src/main.ts
 @ multi ./src/main.ts

Error: ./node_modules/@arcgis/core/core/accessorSupport/extensions/serializableProperty/reader.js 5:346
Module parse failed: Unexpected token (5:346)
File was processed with these loaders:
 * ./node_modules/@angular-devkit/build-angular/src/babel/webpack-loader.js
 * ./node_modules/@ngtools/webpack/src/ivy/index.js
You may need an additional loader to handle the result of these loaders.
| See https://js.arcgis.com/4.24/esri/copyright.txt for details.
| */
> import t from"../../../Logger.js";import{setDeepValue as e}from"../../../object.js";import r from"../../../Warning.js";import{getOwnClassMetadata as n}from"../../metadata.js";import{isCollection as o}from"./type.js";const i=t.getLogger("esri.core.accessorSupport.extensions.serializableProperty.reader");function p(t,r,n){t&&(!n&&!r.read||r.read?.reader||!1===r.read?.enabled||l(t)&&e("read.reader",s(t),r))}function s(t){const e=t.ndimArray??0;if(e>1)return c(t);if(1===e)return a(t);if("type"in t&&d(t.type)){const e=t.type.prototype?.itemType?.Type,r=a("function"==typeof e?{type:e}:{types:e});return(e,n,o)=>{const i=r(e,n,o);return i?new t.type(i):i}}return u(t)}function u(t){return"type"in t?y(t.type):g(t.types)}function y(t){return t.prototype.read?(e,r,n)=>{if(null==e)return e;const o=typeof e;if("object"!==o)return void i.error(`Expected JSON value of type 'object' to deserialize type '${t.prototype.declaredClass}', but got '${o}'`);const p=new t;return p.read(e,n),p}:t.fromJSON}function f(t,e,r,n){return 0!==n&&Array.isArray(e)?e.map((e=>f(t,e,r,n-1))):t(e,void 0,r)}function c(t){const e=u(t),r=f.bind(null,e),n=t.ndimArray??0;return(t,e,o)=>{if(null==t)return t;t=r(t,o,n);let i=n,p=t;for(;i>0&&Array.isArray(p);)i--,p=p[0];if(void 0!==p)for(let r=0;r<i;r++)t=[t];return t}}function a(t){const e=u(t);return(t,r,n)=>{if(null==t)return t;if(Array.isArray(t)){const r=[];for(const o of t){const t=e(o,void 0,n);void 0!==t&&r.push(t)}return r}const o=e(t,void 0,n);return void 0!==o?[o]:void 0}}function d(t){if(!o(t))return!1;const e=t.prototype.itemType;return!(!e||!e.Type)&&("function"==typeof e.Type?m(e.Type):j(e.Type))}function l(t){return"types"in t?j(t.types):m(t.type)}function m(t){return!Array.isArray(t)&&(!!t&&t.prototype&&("read"in t.prototype||"fromJSON"in t||d(t)))}function j(t){for(const e in t.typeMap){if(!m(t.typeMap[e]))return!1}return!0}function g(t){let e=null;const n=t.errorContext??"type";return(o,p,s)=>{if(null==o)return o;const u=typeof o;if("object"!==u)return void i.error(`Expected JSON value of type 'object' to deserialize, but got '${u}'`);e||(e=v(t));const y=t.key;if("string"!=typeof y)return;const f=o[y],c=f?e[f]:t.defaultKeyValue?t.typeMap[t.defaultKeyValue]:void 0;if(!c){const t=`Type '${f||"unknown"}' is not supported`;return s&&s.messages&&o&&s.messages.push(new r(`${n}:unsupported`,t,{definition:o,context:s})),void i.error(t)}const a=new c;return a.read(o,s),a}}function v(t){const e={};for(const r in t.typeMap){const o=t.typeMap[r],i=n(o.prototype);if("function"==typeof t.key)continue;const p=i.properties[t.key];if(!p)continue;p.json?.type&&Array.isArray(p.json.type)&&1===p.json.type.length&&"string"==typeof p.json.type[0]&&(e[p.json.type[0]]=o);const s=p.json?.write;if(!s||!s.writer){e[r]=o;continue}const u=s.target,y="string"==typeof u?u:t.key,f={};s.writer(r,f,y),f[y]&&(e[f[y]]=o)}return e}export{p as create,s as createTypeReader};
|
 @ ./node_modules/@arcgis/core/core/accessorSupport/extensions/serializableProperty.js 5:109-167 5:621-622 5:721-722
 @ ./node_modules/@arcgis/core/core/accessorSupport/decorators/subclass.js
 @ ./node_modules/@arcgis/core/geometry/Polygon.js
 @ ./src/app/features/header/title/senterlinje/senterlinje.component.ts
 @ ./src/app/app.module.ts
 @ ./src/main.ts
 @ multi ./src/main.ts

Error: ./node_modules/@arcgis/core/core/accessorSupport/DefaultsStore.js 5:347
Module parse failed: Unexpected token (5:347)
File was processed with these loaders:
 * ./node_modules/@angular-devkit/build-angular/src/babel/webpack-loader.js
 * ./node_modules/@ngtools/webpack/src/ivy/index.js
You may need an additional loader to handle the result of these loaders.
| See https://js.arcgis.com/4.24/esri/copyright.txt for details.
| */
> import{clone as i}from"../lang.js";import{OriginId as e}from"./PropertyOrigin.js";class s{constructor(){this._values=new Map,this.multipleOriginsSupported=!1}clone(e){const t=new s;return this._values.forEach(((s,r)=>{e&&e.has(r)||t.set(r,i(s.value),s.origin)})),t}get(i,e){e=this._normalizeOrigin(e);const s=this._values.get(i);return null==e||s?.origin===e?s?.value:void 0}originOf(i){return this._values.get(i)?.origin??e.USER}keys(i){i=this._normalizeOrigin(i);const e=[...this._values.keys()];return null==i?e:e.filter((e=>this._values.get(e)?.origin===i))}set(i,s,r){if((r=this._normalizeOrigin(r))===e.DEFAULTS){const e=this._values.get(i);if(e&&null!=e.origin&&e.origin>r)return}this._values.set(i,new t(s,r))}delete(i,e){null!=(e=this._normalizeOrigin(e))&&this._values.get(i)?.origin!==e||this._values.delete(i)}has(i,e){return null!=(e=this._normalizeOrigin(e))?this._values.get(i)?.origin===e:this._values.has(i)}forEach(i){this._values.forEach((({value:e},s)=>i(e,s)))}_normalizeOrigin(i){if(null!=i)return i===e.DEFAULTS?i:e.USER}}class t{constructor(i,e){this.value=i,this.origin=e}}export{s as DefaultsStore};
|
 @ ./node_modules/@arcgis/core/core/JSONSupport.js 5:115-182 5:591-592
 @ ./node_modules/@arcgis/core/geometry/SpatialReference.js
 @ ./node_modules/@arcgis/core/geometry/Polygon.js
 @ ./src/app/features/header/title/senterlinje/senterlinje.component.ts
 @ ./src/app/app.module.ts
 @ ./src/main.ts
 @ multi ./src/main.ts

Error: ./node_modules/@arcgis/core/core/accessorSupport/extensions/serializableProperty/writer.js 5:354
Module parse failed: Unexpected token (5:354)
File was processed with these loaders:
 * ./node_modules/@angular-devkit/build-angular/src/babel/webpack-loader.js
 * ./node_modules/@ngtools/webpack/src/ivy/index.js
You may need an additional loader to handle the result of these loaders.
| See https://js.arcgis.com/4.24/esri/copyright.txt for details.
| */
> import r from"../../../Error.js";import e from"../../../Logger.js";import{setDeepValue as t}from"../../../object.js";import{isCollection as n}from"./type.js";const i=e.getLogger("esri.core.accessorSupport.extensions.serializableProperty.writer");function o(r,e){if(!e.write||e.write.writer||!1===e.write.enabled&&!e.write.overridePolicy)return;const t=r?.ndimArray??0;r&&(1===t||"type"in r&&n(r.type))?e.write.writer=c:t>1?e.write.writer=w(t):e.types?Array.isArray(e.types)?e.write.writer=f(e.types[0]):e.write.writer=s(e.types):e.write.writer=p}function s(r){return(e,t,n,i)=>e?u(e,r,i)?p(e,t,n,i):void 0:p(e,t,n,i)}function u(e,t,n){for(const r in t.typeMap)if(e instanceof t.typeMap[r])return!0;if(n?.messages){const o=t.errorContext??"type",s=`Values of type '${("function"!=typeof t.key?e[t.key]:e.declaredClass)??"Unknown"}' cannot be written`;n&&n.messages&&e&&n.messages.push(new r(`${o}:unsupported`,s,{definition:e,context:n})),i.error(s)}return!1}function f(r){return(e,t,n,i)=>{if(!e||!Array.isArray(e))return p(e,t,n,i);return p(e.filter((e=>u(e,r,i))),t,n,i)}}function p(r,e,n,i){t(n,y(r,i),e)}function y(r,e){return r&&"function"==typeof r.write?r.write({},e):r&&"function"==typeof r.toJSON?r.toJSON():"number"==typeof r?a(r):r}function a(r){return r===-1/0?-Number.MAX_VALUE:r===1/0?Number.MAX_VALUE:isNaN(r)?null:r}function c(r,e,n,i){let o;null===r?o=null:r&&"function"==typeof r.map?(o=r.map((r=>y(r,i))),"function"==typeof o.toArray&&(o=o.toArray())):o=[y(r,i)],t(n,o,e)}function l(r,e,t){return 0!==t&&Array.isArray(r)?r.map((r=>l(r,e,t-1))):y(r,e)}function w(r){return(e,n,i,o)=>{let s;if(null===e)s=null;else{s=l(e,o,r);let t=r,n=s;for(;t>0&&Array.isArray(n);)t--,n=n[0];if(void 0!==n)for(let r=0;r<t;r++)s=[s]}t(i,s,n)}}export{o as create,a as numberToJSON};
|
 @ ./node_modules/@arcgis/core/core/accessorSupport/extensions/serializableProperty.js 5:230-288 5:714-715 5:736-737
 @ ./node_modules/@arcgis/core/core/accessorSupport/decorators/subclass.js
 @ ./node_modules/@arcgis/core/geometry/Polygon.js
 @ ./src/app/features/header/title/senterlinje/senterlinje.component.ts
 @ ./src/app/app.module.ts
 @ ./src/main.ts
 @ multi ./src/main.ts

Error: ./node_modules/@arcgis/core/core/accessorSupport/write.js 5:430
Module parse failed: Unexpected token (5:430)
File was processed with these loaders:
 * ./node_modules/@angular-devkit/build-angular/src/babel/webpack-loader.js
 * ./node_modules/@ngtools/webpack/src/ivy/index.js
You may need an additional loader to handle the result of these loaders.
| See https://js.arcgis.com/4.24/esri/copyright.txt for details.
| */
> import{equals as r}from"../arrayUtils.js";import e from"../Error.js";import t from"../Logger.js";import{idToReadableName as i,OriginId as o,nameToId as n}from"./PropertyOrigin.js";import{getProperties as s,merge as u}from"./utils.js";import{originSpecificWritePropertyDefinition as l}from"./extensions/serializableProperty.js";const a=t.getLogger("esri.core.accessorSupport.write");function f(r,e,t,i,o){const n={};return e.write?.writer?.call(r,i,n,t,o),n}function p(r,t,i,s,u,l){if(!s||!s.write)return!1;const f=r.get(i);if(!u&&s.write.overridePolicy){const e=s.write.overridePolicy.call(r,f,i,l);void 0!==e&&(u=e)}if(u||(u=s.write),!u||!1===u.enabled)return!1;if((null===f&&!u.allowNull&&!u.writerEnsuresNonNull||void 0===f)&&u.isRequired){const t=new e("web-document-write:property-required",`Missing value for required property '${i}' on '${r.declaredClass}'`,{propertyName:i,target:r});return t&&l&&l.messages?l.messages.push(t):t&&!l&&a.error(t.name,t.message),!1}if(void 0===f)return!1;if(null===f&&!u.allowNull&&!u.writerEnsuresNonNull)return!1;if((!t.store.multipleOriginsSupported||t.store.originOf(i)===o.DEFAULTS)&&c(r,i,l,s,f))return!1;if(!u.ignoreOrigin&&l&&l.origin&&t.store.multipleOriginsSupported){if(t.store.originOf(i)<n(l.origin))return!1}return!0}function c(e,t,i,o,n){const s=o.default;if(void 0===s)return!1;if(null!=o.defaultEquals)return o.defaultEquals(n);if("function"==typeof s){if(Array.isArray(n)){const o=s.call(e,t,i);return r(o,n)}return!1}return s===n}function g(r,e,t,i){const o=s(r),n=o.metadatas,u=l(n[e],i);return!!u&&p(r,o,e,u,t,i)}function d(r,e,t){if(r&&"function"==typeof r.toJSON&&(!r.toJSON.isDefaultToJSON||!r.write))return u(e,r.toJSON(t));const o=s(r),n=o.metadatas;for(const s in n){const a=l(n[s],t);if(!p(r,o,s,a,void 0,t))continue;const c=r.get(s),g=f(r,a,a.write&&"string"==typeof a.write.target?a.write.target:s,c,t);Object.keys(g).length>0&&(e=u(e,g),t?.resources?.pendingOperations?.length&&Promise.all(t.resources.pendingOperations).then((()=>u(e,g))),t&&t.writtenProperties&&t.writtenProperties.push({target:r,propName:s,oldOrigin:i(o.store.originOf(s)),newOrigin:t.origin}))}return e}export{g as willPropertyWrite,d as write};
|
 @ ./node_modules/@arcgis/core/core/JSONSupport.js 5:373-424 5:655-656
 @ ./node_modules/@arcgis/core/geometry/SpatialReference.js
 @ ./node_modules/@arcgis/core/geometry/Polygon.js
 @ ./src/app/features/header/title/senterlinje/senterlinje.component.ts
 @ ./src/app/app.module.ts
 @ ./src/main.ts
 @ multi ./src/main.ts

Error: ./node_modules/@arcgis/core/core/unitUtils.js 5:6384
Module parse failed: Unexpected token (5:6384)
File was processed with these loaders:
 * ./node_modules/@angular-devkit/build-angular/src/babel/webpack-loader.js
 * ./node_modules/@ngtools/webpack/src/ivy/index.js
You may need an additional loader to handle the result of these loaders.
| See https://js.arcgis.com/4.24/esri/copyright.txt for details.
| */
> import"./has.js";import{strict as e}from"./jsonMap.js";import{unwrapOr as s,isSome as t,isNone as r}from"./maybe.js";import{getReferenceEllipsoid as i}from"../geometry/projectionEllipsoid.js";import n from"../geometry/SpatialReference.js";import{earth as a,mars as u,moon as c}from"../geometry/support/Ellipsoid.js";import{isEarth as o,isWKIDFromMars as l,isWKIDFromMoon as m}from"../geometry/support/spatialReferenceUtils.js";import f from"../geometry/support/WKIDUnitConversion.js";const d=39.37,U=a.radius*Math.PI/200,q=/UNIT\[([^\]]+)\]\]$/i,p=f,h=/UNIT\[([^\]]+)\]/i,B=new Set([4261,4305,4807,4810,4811,4812,4816,4819,4821,4901,4902,37225,104139,104140]),b=e()({meter:"meters",foot:"feet",foot_us:"us-feet",foot_clarke:"clarke-feet",yard_clarke:"clarke-yards",link_clarke:"clarke-links",yard_sears:"sears-yards",foot_sears:"sears-feet",chain_sears:"sears-chains",chain_benoit_1895_b:"benoit-1895-b-chains",yard_indian:"indian-yards",yard_indian_1937:"indian-1937-yards",foot_gold_coast:"gold-coast-feet",chain_sears_1922_truncated:"sears-1922-truncated-chains","50_kilometers":"50-kilometers","150_kilometers":"150-kilometers"}),k=e=>e*e,y=e=>e*e*e,g={length:{baseUnit:"meters",units:{millimeters:{inBaseUnits:.001},centimeters:{inBaseUnits:.01},decimeters:{inBaseUnits:.1},meters:{inBaseUnits:1},kilometers:{inBaseUnits:1e3},inches:{inBaseUnits:.0254},feet:{inBaseUnits:.3048},yards:{inBaseUnits:.9144},miles:{inBaseUnits:1609.344},"nautical-miles":{inBaseUnits:1852},"us-feet":{inBaseUnits:1200/3937}}},area:{baseUnit:"square-meters",units:{"square-millimeters":{inBaseUnits:k(.001)},"square-centimeters":{inBaseUnits:k(.01)},"square-decimeters":{inBaseUnits:k(.1)},"square-meters":{inBaseUnits:1},"square-kilometers":{inBaseUnits:k(1e3)},"square-inches":{inBaseUnits:k(.0254)},"square-feet":{inBaseUnits:k(.3048)},"square-yards":{inBaseUnits:k(.9144)},"square-miles":{inBaseUnits:k(1609.344)},"square-us-feet":{inBaseUnits:k(1200/3937)},acres:{inBaseUnits:.0015625*k(1609.344)},ares:{inBaseUnits:100},hectares:{inBaseUnits:1e4}}},volume:{baseUnit:"liters",units:{liters:{inBaseUnits:1},"cubic-millimeters":{inBaseUnits:1e3*y(.001)},"cubic-centimeters":{inBaseUnits:1e3*y(.01)},"cubic-decimeters":{inBaseUnits:1e3*y(.1)},"cubic-meters":{inBaseUnits:1e3},"cubic-kilometers":{inBaseUnits:1e3*y(1e3)},"cubic-inches":{inBaseUnits:1e3*y(.0254)},"cubic-feet":{inBaseUnits:1e3*y(.3048)},"cubic-yards":{inBaseUnits:1e3*y(.9144)},"cubic-miles":{inBaseUnits:1e3*y(1609.344)}}},angle:{baseUnit:"radians",units:{radians:{inBaseUnits:1},degrees:{inBaseUnits:Math.PI/180}}}},_=(()=>{const e={};for(const s in g)for(const t in g[s].units)e[t]=s;return e})();function M(e,s,t){return e*g[t].units[s].inBaseUnits}function w(e,s,t){return e/g[t].units[s].inBaseUnits}const S=["metric","imperial","square-inches","square-feet","square-yards","square-miles","square-us-feet","square-meters","square-kilometers","acres","ares","hectares"],j=["metric","imperial","inches","feet","yards","miles","nautical-miles","us-feet","meters","kilometers"],I=new Map([["meters","square-meters"],["feet","square-feet"],["us-feet","square-us-feet"]]);function P(e){return"imperial"===e||"metric"===e}function C(e){const s=_[e];if(!s)throw new Error("unknown type");return s}function D(e){return g[e].baseUnit}function x(e){return D(C(e))}function E(e,s=null){return s=s||C(e),g[s].baseUnit===e}function N(e,s,t){if(s===t)return e;const r=C(s);if(r!==C(t))throw new Error("incompatible units");const i=E(s,r)?e:M(e,s,r);return E(t,r)?i:w(i,t,r)}function v(e,s,t){switch(t){case"metric":return R(e,s);case"imperial":return K(e,s);default:return t}}function F(e,s,t){switch(t){case"metric":return J(e,s);case"imperial":return A(e,s);default:return t}}function O(e,s,t){switch(t){case"metric":return T(e,s);case"imperial":return Y(e,s);default:return t}}function R(e,s){const t=N(e,s,"meters");return Math.abs(t)<3e3?"meters":"kilometers"}function J(e,s){const t=N(e,s,"meters");return Math.abs(t)<1e5?"meters":"kilometers"}function K(e,s){const t=N(e,s,"feet");return Math.abs(t)<1e3?"feet":"miles"}function A(e,s){const t=N(e,s,"feet");return Math.abs(t)<1e5?"feet":"miles"}function T(e,s){const t=N(e,s,"square-meters");return Math.abs(t)<3e6?"square-meters":"square-kilometers"}function Y(e,s){const t=N(e,s,"square-feet");return Math.abs(t)<1e6?"square-feet":"square-miles"}function G(e,s,t){return N(e,s,"meters")/(t*Math.PI/180)}function H(e){return b.fromJSON(e.toLowerCase())||null}function L(e){return b.toJSON(e)||null}function W(e){if(e&&"object"==typeof e&&!o(e))return 1;const s=z(e);return s>1e5?1:s}function $(e){return z(e)>=(e instanceof n?i(e).metersPerDegree:1e5)?"meters":Z(e)}function z(e,t=a.metersPerDegree){return s(Q(e,!0),t)}function Q(e,s=!1){let t,r,i=null;if(null!=e&&("object"==typeof e?(t=e.wkid,r=e.wkt):"number"==typeof e?t=e:"string"==typeof e&&(r=e)),t){if(l(t))return u.metersPerDegree;if(m(t))return c.metersPerDegree;i=p.values[p[t]],!i&&s&&B.has(t)&&(i=U)}else r&&(ie(r)?i=V(q.exec(r),i):re(r)&&(i=V(h.exec(r),i)));return i}function V(e,s){return e&&e[1]?X(e[1]):s}function X(e){return parseFloat(e.split(",")[1])}function Z(e){let s,r,i=null;if(null!=e&&("object"==typeof e?(s=e.wkid,r=e.wkt):"number"==typeof e?s=e:"string"==typeof e&&(r=e)),s)i=p.units[p[s]];else if(r){const e=ie(r)?q:re(r)?h:null;if(e){const s=e.exec(r);s&&s[1]&&(i=ae(s[1]))}}return t(i)?H(i):null}function ee(e){const s=Z(e);return r(s)||!j.includes(s)?null:s}function se(e){const s=$(e);return r(s)||!j.includes(s)?null:s}function te(e){const s=Z(e);return r(s)?null:I.get(s)}function re(e){return/^GEOCCS/i.test(e)}function ie(e){return/^PROJCS/i.test(e)}const ne=1e-7;function ae(e){const s=/[\\"\\']{1}([^\\"\\']+)/.exec(e);let t=s&&s[1];if(!t||!p.units.includes(t)){const s=X(e);t=null;const r=p.values;for(let e=0;e<r.length;++e)if(Math.abs(s-r[e])<ne){t=p.units[e];break}}return t}function ue(e){const s=Z(e);if(r(s))return null;switch(s){case"feet":case"us-feet":case"clarke-feet":case"clarke-yards":case"clarke-links":case"sears-yards":case"sears-feet":case"sears-chains":case"benoit-1895-b-chains":case"indian-yards":case"indian-1937-yards":case"gold-coast-feet":case"sears-1922-truncated-chains":return"imperial";case"50-kilometers":case"150-kilometers":case"meters":return"metric"}return null}function ce(e){const t="metric";if(r(e))return t;const i=e.map,n=i&&"portalItem"in i?i.portalItem?.portal:null;if(n){switch(n?.user?.units??n.units){case t:return t;case"english":return"imperial"}}return s(ue(e.spatialReference),t)}const oe={esriAcres:"acres",esriAres:"ares",esriHectares:"hectares",esriSquareCentimeters:"square-centimeters",esriSquareDecimeters:"square-decimeters",esriSquareFeet:"square-feet",esriSquareInches:"square-inches",esriSquareKilometers:"square-kilometers",esriSquareMeters:"square-meters",esriSquareMiles:"square-miles",esriSquareMillimeters:"square-millimeters",esriSquareUsFeet:"square-us-feet",esriSquareYards:"square-yards"},le={esriCentimeters:"centimeters",esriDecimeters:"decimeters",esriFeet:"feet",esriInches:"inches",esriKilometers:"kilometers",esriMeters:"meters",esriMiles:"miles",esriMillimeters:"millimeters",esriNauticalMiles:"nautical-miles",esriYards:"yards"},me=e()(oe),fe=e()(le),de=e()({...oe,...le});export{te as areaUnitFromSpatialReference,me as areaUnitsJSONMap,x as baseUnitForUnit,D as baseUnitForUnitType,N as convertUnit,ce as getDefaultUnitForView,ue as getDefaultUnitSystem,Q as getMetersPerUnit,z as getMetersPerUnitForSR,W as getMetersPerVerticalUnitForSR,Z as getUnitString,$ as getVerticalUnitStringForSR,d as inchesPerMeter,E as isBaseUnit,P as isMeasurementSystem,G as lengthToDegrees,ee as lengthUnitFromSpatialReference,fe as lengthUnitsJSONMap,S as measurementAreaUnits,j as measurementLengthUnits,O as preferredAreaUnit,Y as preferredImperialAreaUnit,K as preferredImperialLengthUnit,A as preferredImperialVerticalLengthUnit,v as preferredLengthUnit,T as preferredMetricAreaUnit,R as preferredMetricLengthUnit,J as preferredMetricVerticalLengthUnit,F as preferredVerticalLengthUnit,H as unitFromRESTJSON,L as unitToRESTJSON,C as unitType,de as unitsJSONMap,se as verticalLengthUnitFromSpatialReference};
|
 @ ./node_modules/@arcgis/core/geometry/support/geodesicUtils.js 5:61-115 5:1851-1852 5:2508-2509 5:5961-5962
 @ ./src/app/features/header/title/senterlinje/senterlinje.component.ts
 @ ./src/app/app.module.ts
 @ ./src/main.ts
 @ multi ./src/main.ts

Error: ./node_modules/@arcgis/core/geometry/support/offset.js 5:66
Module parse failed: Unexpected token (5:66)
File was processed with these loaders:
 * ./node_modules/@angular-devkit/build-angular/src/babel/webpack-loader.js
 * ./node_modules/@ngtools/webpack/src/ivy/index.js
You may need an additional loader to handle the result of these loaders.
| See https://js.arcgis.com/4.24/esri/copyright.txt for details.
| */
> function n(n,r,t,u){return n.x=n.x+r,n.y=n.y+t,null!=u&&(n.z=(n.z??0)+u),n}function r(n,r){return n[0]+=r,n}export{r as offsetCoordsX,n as offsetPoint};
|
 @ ./node_modules/@arcgis/core/geometry/Point.js 5:660-710 5:3817-3818
 @ ./node_modules/@arcgis/core/geometry/Polygon.js
 @ ./src/app/features/header/title/senterlinje/senterlinje.component.ts
 @ ./src/app/app.module.ts
 @ ./src/main.ts
 @ multi ./src/main.ts

Error: ./node_modules/@arcgis/core/core/Accessor.js 5:722
Module parse failed: Unexpected token (5:722)
File was processed with these loaders:
 * ./node_modules/@angular-devkit/build-angular/src/babel/webpack-loader.js
 * ./node_modules/@ngtools/webpack/src/ivy/index.js
You may need an additional loader to handle the result of these loaders.
| See https://js.arcgis.com/4.24/esri/copyright.txt for details.
| */
> import{isIterable as t}from"./iteratorUtils.js";import{applySome as r,isNone as e}from"./maybe.js";import{get as s}from"./accessorSupport/get.js";import{Lifecycle as o}from"./accessorSupport/interfaces.js";import{getOwnClassMetadata as i}from"./accessorSupport/metadata.js";import c from"./accessorSupport/Properties.js";import{set as n}from"./accessorSupport/set.js";import{removeTarget as a,watch as _}from"./accessorSupport/watch.js";import{property as u}from"./accessorSupport/decorators/property.js";import{subclass as h}from"./accessorSupport/decorators/subclass.js";var p;function l(t){if(null==t)return{value:t};if(Array.isArray(t))return{type:[t[0]],value:null};switch(typeof t){case"object":return t.constructor?.__accessorMetadata__||t instanceof Date?{type:t.constructor,value:t}:t;case"boolean":return{type:Boolean,value:t};case"string":return{type:String,value:t};case"number":return{type:Number,value:t};case"function":return{type:t,value:null};default:return}}const d=Symbol("Accessor-Handles");class y{constructor(...t){if(this[p]=null,this.constructor===y)throw new Error("[accessor] cannot instantiate Accessor. This can be fixed by creating a subclass of Accessor");Object.defineProperty(this,"__accessor__",{enumerable:!1,value:new c(this)}),t.length>0&&this.normalizeCtorArgs&&(this.__accessor__.ctorArgs=this.normalizeCtorArgs.apply(this,t))}static createSubclass(t={}){if(Array.isArray(t))throw new Error("Multi-inheritance unsupported since 4.16");const{properties:r,declaredClass:e,constructor:s}=t;delete t.declaredClass,delete t.properties,delete t.constructor;const o=this;class c extends o{constructor(...t){super(...t),this.inherited=null,s&&s.apply(this,t)}}i(c.prototype);for(const i in t){const r=t[i];c.prototype[i]="function"==typeof r?function(...t){const e=this.inherited;let s;this.inherited=function(...t){if(o.prototype[i])return o.prototype[i].apply(this,t)};try{s=r.apply(this,t)}catch(c){throw this.inherited=e,c}return this.inherited=e,s}:t[i]}for(const i in r){const t=l(r[i]);u(t)(c.prototype,i)}return h(e)(c)}postscript(t){const r=this.__accessor__,e=r.ctorArgs||t;r.initialize(),e&&(this.set(e),r.ctorArgs=null),r.constructed(),this.initialize()}initialize(){}destroy(){this.destroyed||(r(this[d],(t=>{t.forEach((t=>t.remove()))})),this[d]=null,a(this),this.__accessor__.destroy())}get initialized(){return this.__accessor__&&this.__accessor__.initialized||!1}get constructed(){return this.__accessor__&&this.__accessor__.lifecycle===o.CONSTRUCTED||!1}get destroyed(){return this.__accessor__&&this.__accessor__.destroyed||!1}commitProperty(t){this.get(t)}get(t){return s(this,t)}hasOwnProperty(t){return this.__accessor__?this.__accessor__.has(t):Object.prototype.hasOwnProperty.call(this,t)}keys(){return this.__accessor__?this.__accessor__.keys():[]}set(t,r){return n(this,t,r),this}watch(t,r,e){return _(this,t,r,e)}own(r){let s=this[d];if(e(s)&&(s=this[d]=new Set),t(r))for(const t of r)s.add(t);else s.add(r)}_clearOverride(t){return this.__accessor__.clearOverride(t)}_override(t,r){return this.__accessor__.override(t,r)}_isOverridden(t){return this.__accessor__.isOverridden(t)}notifyChange(t){this.__accessor__.notifyChange(t)}_get(t){return this.__accessor__.internalGet(t)}_set(t,r){return this.__accessor__.internalSet(t,r),this}}p=d;export{y as default};
|
 @ ./node_modules/@arcgis/core/core/JSONSupport.js 5:43-72 5:1058-1059
 @ ./node_modules/@arcgis/core/geometry/SpatialReference.js
 @ ./node_modules/@arcgis/core/geometry/Polygon.js
 @ ./src/app/features/header/title/senterlinje/senterlinje.component.ts
 @ ./src/app/app.module.ts
 @ ./src/main.ts
 @ multi ./src/main.ts

 

Tags (3)
0 Kudos
13 Replies
AndyGup
Esri Regular Contributor

Hi @turbolego those errors seem to be showing a configuration issue in Angular and not an issue with arcgis/core. Did the app work with a previous version of arcgis/core? We'll need a simple a GitHub repo that reproduces the issue. 

Also, check your TSConfig and browserslistrc. Here's the browsers list from our Angular 11 sample (~early 2021, v4.19) https://github.com/Esri/jsapi-resources/blob/9b4b278c2611f413fdfaa8c880177052fda9e336/esm-samples/js... and tsconfig https://github.com/Esri/jsapi-resources/blob/9b4b278c2611f413fdfaa8c880177052fda9e336/esm-samples/js... 

0 Kudos
turbolego
New Contributor II

Hi Andy and thanks for your reply!

There's no changes in our tsconfig between the version that does build and the version that does not build.

We don't have a browserslistrc file.

Why do you think there's an error with the Angular config?

Out of 3 devs, 1 dev has no issues building while the two other devs cannot build.

We have tried using matching versions of Node and Npm.

0 Kudos
turbolego
New Contributor II

Solved by changing:

"@arcgis/core": "^4.23.7",

"eslint-plugin-import": "latest",
"eslint-plugin-jsdoc": "latest",
"eslint-plugin-prefer-arrow": "latest",

To:

"@arcgis/core": "4.20.2",

"eslint-plugin-import": "2.26.0",
"eslint-plugin-jsdoc": "38.1.6",
"eslint-plugin-prefer-arrow": "1.2.3",

In package.json​

0 Kudos
AndyGup
Esri Regular Contributor

@turbolego  thanks for sharing, we'll look into this further. I'm not liking that you had to downgrade your JS API version to get it to work.

0 Kudos
AndyGup
Esri Regular Contributor

@turbolego can you share your package.json and tsconfig here? Also, please retest using the .browserslistrc file I link to above, and then try setting your tsconfig to target ES2020.

0 Kudos
james-rae
New Contributor III

Just chiming in, am getting similar "unexpected token" errors after bumping to v4.24. Had been pinned at v4.22 due to changes to the hitTest.

File being reported is @arcgis/core/views/2d/engine/webgl/shaders/sources/shaderRepository.js

We're not using angular. Vue 3, and rollup for the bundling (it's rollup that is compaining about the token). I'm still fiddling on my end, but have looked at shaderRepository and it looks fine from a token perspective. Will comment back if I find anything but might also need to stick to v4.22 for now.

0 Kudos
AndyGup
Esri Regular Contributor

Hi All, Please provide a simple GitHub repo that reproduce these errors so that we can investigate your issue. We recommend you start with one of our ES modules samples: https://github.com/Esri/jsapi-resources/tree/master/esm-samples

"unexpected token" errors are very common in JavaScript. It's related to a parsing error in the code. With JavaScript frameworks, this is most commonly caused by configuration issues.

0 Kudos
james-rae
New Contributor III

Just posting a followup for the benefit of anyone encountering a similar scenario.

Our app uses Vite, and was using a Vite plugin to grab our package version number and inject it into an environment variable during the build process. The variable was named __VERSION__.

We discovered the following file in the ESRI JS API now has lines like "#if __VERSION__ == 300" at v4.24, and did not at v4.22.

@arcgis\core\views\2d\engine\webgl\shaders\sources\shaderRepository.js

Something in the Vite / Rollup process was colliding on the name. My build guru is going to patch in some mitigation on our end.

0 Kudos
AndyGup
Esri Regular Contributor

Thanks @james-rae for the heads-up. I've put in an enhancement request to use a less generic naming convention for that variable.

[Update: we won't be able to fix that variable until we drop WebGL1 support, possibly next year 2023. It's a built-in GLSL macro used for checking the current GLSL version.]

 

0 Kudos