arcgis core 4.23 breaks app when build

1717
9
Jump to solution
04-08-2022 09:43 AM
FabianHanggi
New Contributor II

Hello

Just upgraded from 4.22 to 4.23. When i run my app locally using npm start things work fine.

However when i build the app (npm run build) the maps don't load anymore. I see this error in the console

Uncaught (in promise) TypeError: _ is not a function
at e.value (RenderingContext.js:5:23779)
at e.value (RenderingContext.js:5:2866)
at new e (RenderingContext.js:5:1458)
at new i (Stage.js:5:2261)
at u.value (MapView.js:5:17175)
at u.<anonymous> (View.js:5:3490)
at watch.js:5:2481
at i (trackingUtils.js:5:281)
at p (trackingUtils.js:5:795)
at e.i [as _notify] (trackingUtils.js:5:288)

When i go back to 4.22 things work.

I'm using node v12.13.1 and npm 6.14.8

Does anyone else have these issues?

Thank you

Fabian

0 Kudos
1 Solution

Accepted Solutions
AndyGup
Esri Regular Contributor

Hi @FabianHanggi sorry for the delay, this seems to be an issue with the browserslist. No clue why React uses those default params. I used the following settings and it built and ran on my machine:

  "browserslist": {
    "production": [
      "last 1 chrome version",
      "last 1 firefox version",
      "last 2 safari major versions",
      "last 2 edge major versions",
      "last 2 iOS major versions",
      "Firefox ESR"
    ],
    "development": [
      "last 1 chrome version",
      "last 1 firefox version",
      "last 2 safari major versions",
      "last 2 edge major versions",
      "last 2 iOS major versions",
      "Firefox ESR"    ]
  }

 

View solution in original post

9 Replies
AndyGup
Esri Regular Contributor

@FabianHanggican you provide a github repository that reproduces the issue? If you don't want to share it publicly you can direct message me with a link.

Also, if you haven't had a chance yet, be sure to take a look at the 4.23 release notes in the breaking changes section: https://developers.arcgis.com/javascript/latest/release-notes/#breaking-changes.

FabianHanggi
New Contributor II

Hi AndyGup

I attached a zip file where i was able to reproduce my issue .

Here is what you have to do.

unzip it into a folder 

run npm install

run npm run build

deploy the app somewhere where you can run it on a server .i'm using IIS that's why there is a web.config file in my public folder with a rewrite rule. maybe you don't need that

when you run the app you should see a button. show map. click it. because the app is using 4.23.7 version you should just see a white screen. the map is not loaded.

edit package.json and change the version of arcgis to 4.22.2. run install and build again.

now the map loads.

note that i could not reproduce the  "TypeError: _ is not a function" as described in my original post. but i have a lot more code in my real app which i cannot reproduce in this sample

Let me know how it goes.

Thank you

Fabian

0 Kudos
AndyGup
Esri Regular Contributor

Hi @FabianHanggi sorry for the delay, this seems to be an issue with the browserslist. No clue why React uses those default params. I used the following settings and it built and ran on my machine:

  "browserslist": {
    "production": [
      "last 1 chrome version",
      "last 1 firefox version",
      "last 2 safari major versions",
      "last 2 edge major versions",
      "last 2 iOS major versions",
      "Firefox ESR"
    ],
    "development": [
      "last 1 chrome version",
      "last 1 firefox version",
      "last 2 safari major versions",
      "last 2 edge major versions",
      "last 2 iOS major versions",
      "Firefox ESR"    ]
  }

 

JackFairfield
Occasional Contributor II

I ran into this same issue in my CRA app.  Thanks for the browserslist fix above.  Do we think the issue is including IE11 basically?  And will this be fixed for 4.14?  Thanks

0 Kudos
AndyGup
Esri Regular Contributor

Hi@JackFairfield, this is a framework configuration issue, I didn't see any ArcGIS JS API bug.  It's common for the browserslist to be tweaked for performance and appropriate transpiling based on the system requirements of any dependencies. Note, we dropped IE 11 and Edge Legacy support back in December 2020 at 4.18 - more details here: https://developers.arcgis.com/javascript/latest/4.18/#end-of-ie11edge-legacy-support. Our latest System Requirements are described here: https://developers.arcgis.com/javascript/latest/system-requirements/

0 Kudos
JackFanZhang
Occasional Contributor

Thanks AndyGup, the broswerlist works!

0 Kudos
DylanKennard
New Contributor III

Hey @FabianHanggi - We have the same issue and the same error you posted. We rolled back and still it does not work. The Browserlist suggestion did not fix it either. Anything you ever found deep in the code that was trigger this?

The one thing I noticed is we are using node 16. We never deployed the app, so we never knew what it ever worked on. This is our first time deploying.

0 Kudos
AndyGup
Esri Regular Contributor

@DylanKennardnode 16 shouldn't be causing that error - on the surface it looks like a transpiler issue. If you can provide a simple github repo that reproduces the error we'll take a look.

0 Kudos
FabianHanggi
New Contributor II

Hi Dylan

Try to delete package-json and the node_modules folder. then run npm install again.

That fixed it for me together with the browserslist. I'm using node 16.4.2 and npm 8.5.0

Fabian

0 Kudos