Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Widgets in ES Modules #277

Closed
2 tasks
sasteigerwald opened this issue Mar 4, 2021 · 4 comments
Closed
2 tasks

Widgets in ES Modules #277

sasteigerwald opened this issue Mar 4, 2021 · 4 comments

Comments

@sasteigerwald
Copy link

I have some custom widgets I've developed in Typescript. I have the compiled JS file from a TSX file, etc. I'm attempting to bring that into my Angular project that uses ES Modules and have made various edits to my tsconfig file in attempts to support importing my widgets. But I always receive various failures on compile, the latest being "TypeError: Recenter is not a constructor". How does one use custom widgets in Angular with ES Modules?

I am reporting an issue with

  • TypeScript definitions
  • another resource in this repository
@andygup
Copy link
Member

andygup commented Mar 4, 2021

We don't have an official sample or doc, yet(!), for a custom widget built with ESM. It's on our TODOs, so you are on the bleeding edge.

There is a repo with a very basic Hello World widget prototype that you are welcome to look at for hints. It uses TypeScript and Webpack: https://github.com/kellyhutchins/arcgis-core-demo-app.

@sasteigerwald
Copy link
Author

Awesome, thanks @andygup!

@sasteigerwald
Copy link
Author

I now have the "Recenter" widget sample working in my ESM Angular app. Awesome! Thanks again for the help. The key things I was missing was;

  • use the TSX file straight-up instead of the compiled JS
  • The paths in the include in tsconfig were wrong in mine, using what Kelly had worked

@andygup
Copy link
Member

andygup commented Mar 5, 2021

Sweet! Glad you got it working. I'll go ahead and close the issue.

@andygup andygup closed this as completed Mar 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants