DavidWells / DavidWells/analytics
Unable to load @analytics/aws-pinpoint via (Dojo) AMD loader
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 2.7k
- Forks
- 267
- PR merge metrics
- No merged PRs in 30d
Description
I have a library that imports from analytics and @analytics/aws-pinpoint.
We distribute a UMD bundle that we build with rollup. Because of an underlying issue w/ @aws-sdk/client-pinpoint causing the bundle to require several node built-ins (crypto, fs, etc) we end up having to exclude @analytics/aws-pinpoint from our bundle. We are able to then successfully use our UMD bundle by using <script> tags that use the globals. For example, you would add the following to your HTML:
<script src="https://unpkg.com/@analytics/aws-pinpoint@0.7/dist/@analytics/aws-pinpoint.js"></script>
<script src="./path/to/our/library.js"></script>
And then our library is able to use the analyticsAWSPinpoint global and everything works fine.
However, we have a client that uses Dojo to build their application, and when we they configure the Dojo AMD loader to load @analytics/aws-pinpoint (i.e. like: dojoConfig.paths['@analytics/aws-pinpoint'] = 'https://unpkg.com/@analytics/aws-pinpoint@0.7/dist/@analytics/aws-pinpoint' our library fails when trying to read the value exported by that package. It's as if nothing is exported.
Maybe this is a known issue b/c I see that most of the other @analytics packages distribute a umd build, so maybe you ran into the same issues that I did when trying to bundle the underlying @aws-sdk/client-pinpoint and therefore we should not expect @analytics/aws-pinpoint to work in AMD loaders?
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the published dist/@analytics/aws-pinpoint.js artifact and reproduce loading it through Dojo's AMD loader, comparing its export with the analyticsAWSPinpoint global used by script tags. Check how the other @analytics UMD builds behave; done means the package exposes a usable value through AMD without breaking the existing global usage.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- aws, javascript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100