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

SystemJS + no .umd.js - how to load it correctly? #323

Open
crumhorn opened this issue Mar 9, 2018 · 1 comment
Open

SystemJS + no .umd.js - how to load it correctly? #323

crumhorn opened this issue Mar 9, 2018 · 1 comment

Comments

@crumhorn
Copy link

crumhorn commented Mar 9, 2018

Summary:

I wanted to test this cache out after reading about it on the Apollo thread about the slow caching on the default InMemoryCache for large datasets, but I can't seem to get this to load up in Angular 2 using SystemJS. What .js do you point it at for SystemJS integration? (I'm compiling toward es5 as we sadly need to support IE11).

I saw no *.umd.js file so I tried a few of the others with no luck. The highest level /src/index.js seems like it should be the main target, but when that one loads, the call-stack for additional modules goes pretty crazy and fail due to incorrect paths and other references, here's a log:

GET /node_modules/apollo-cache-hermes/src/util.js 200 1.000 ms - -
GET /node_modules/apollo-cache-hermes/src/apollo.js 200 0.854 ms - -
GET /make-error 200 0.695 ms - -
GET /node_modules/apollo-cache-hermes/src/context.js 200 0.669 ms - -
GET /node_modules/apollo-cache-hermes/src/operations.js 200 0.758 ms - -
GET /deep-freeze-strict 200 0.612 ms - -
GET /node_modules/apollo-cache-hermes/src/nodes.js 200 0.617 ms - -
GET /lodash.isequal 200 0.708 ms - -
GET /lodash.get 200 0.644 ms - -

The references in systemjs.config.js are currently:

'apollo-cache-hermes': 'npm:apollo-cache-hermes',
'apollo-cache-hermes': {main: 'src/index.js', defaultExtension: 'js'},

Thanks!

@nevir
Copy link
Contributor

nevir commented Mar 13, 2018

Yeah, this project isn't set up for SystemJS directly (no prebuilt umd module); it currently expects a CommonJS approach (or to be pulled in via a bundler)

For now, I'd recommend leveraging https://github.com/systemjs/builder (or webpack) to bundle the cache and its dependencies into a single module for SystemJS to consume

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