Renaming Widget Error: Cannot read property 'widgetType' of undefined

1383
17
Jump to solution
02-15-2021 10:43 AM
DaveFullerton
Occasional Contributor III

Update:  If you read through you will find that renaming widgets was the issue.

Up to now I have been working with Dev Edition v1.1 and wanted to try migrating to v1.3. When I ran into trouble, I tried migrating to v1.2 where I did not encounter this error:

Capture.PNG

My project has 2 custom widgets that I developed, but only one of them fails. A third widget that also fails is simply a copy of the argis-map widget that I renamed and made a few changes in mapbase.tsx to disable all navigation (replacing/enhancing the functionality of the disable zoom scrolling option). All 3 custom widgets worked correctly in v1.3 when I tested them in a new ExB project. Again, I have no problems migrating to v1.2.


I also see errors in the server command window:

Capture2.PNG

Any thoughts regarding this would be appreciated.

0 Kudos
1 Solution

Accepted Solutions
Junshan_Liu
New Contributor III

To change a widget name, you need to:

1. Stop webpack in client

2. Change the folder name

3. Change the name in manifest.json

4. Change the reference in apps/#/config.json and apps/#/resource/config.json (one config is for published version, one config is for draft version)

5. Start webpack

View solution in original post

17 Replies
AlexisCuicui
New Contributor II

Good afternoon,

Look in your browser console if the loading of the API isn't blocked du to CORS request.

https://HOSTNAME/arcgis_api_js/library/4.18/dojo/dojo.js

I had the same issue, until i enabled CORS requests on my server.

0 Kudos
DaveFullerton
Occasional Contributor III

I am running the developer edition on a pc (IIS turned on, of course).  Here are the errors from the console:

image.png

What made you think that enabling CORS was the answer?

0 Kudos
AlexisCuicui
New Contributor II

I had a similar issue with the same prompt error message. But it seems to be different in your case.

I may ask a basic question but, are the file from the 404 error accessible from file explorer in client/dist/widgets ?

0 Kudos
DaveFullerton
Occasional Contributor III

This is not a basic question for me, Alexis.  I don't see anything there or within the widget directory:

image.png

image.png

0 Kudos
AlexisCuicui
New Contributor II

The only way , I could reproduce your error was to delete/empty the manifest file into the Widget.

Are you Widget in the client/your-extensions/widget repository ?

Is your client side started on NPM ?

0 Kudos
DaveFullerton
Occasional Contributor III

Thanks for trying that Alexis.  The answer is a definitive yes to both questions.  I have not tried enabling CORS yet.  Developer Edition has been installed on a PC.  We have a new IT director and he has recently taken away our administrator access to PCs.  I cannot run IIS Manager anymore and am waiting to hear back from a system administrator (who is now overloaded due stricter policies).

0 Kudos
Junshan_Liu
New Contributor III

@DaveFullerton I think you may not run "npm start" in the client folder. The custom widgets need to be compiled when they are upgraded to the new version.

0 Kudos
DaveFullerton
Occasional Contributor III

As I told Alexis above, web pack was running.  I tried it many things and restarted web pack repeatedly to try those different things.  Also, as stated in the original post, one of my custom widgets did work correctly.  Custom widgets for a different application worked correctly too.

0 Kudos
Junshan_Liu
New Contributor III

This looks strange if the widget is in the dist folder. Can you launch the URL in a new tab that shown as 404 in the console?

0 Kudos