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

Fix "Module x.js did not instantiate" when name passed to System.register() #1885

Merged
merged 1 commit into from
Jan 11, 2019
Merged

Fix "Module x.js did not instantiate" when name passed to System.register() #1885

merged 1 commit into from
Jan 11, 2019

Conversation

paulmelnikow
Copy link
Contributor

Fix #1884

@guybedford
Copy link
Member

Thanks for the fix here, so the idea is that the named registration should just be an "empty module" and not the "last named registered module" in the bundle. As otherwise it's kind of arbitrary, although we could come up with a consistent convention there.

Could you please also add a test for this?

@paulmelnikow
Copy link
Contributor Author

I don't have enough context to understand what you mean by that. Could we chat on gitter?

@guybedford
Copy link
Member

Sure, I've responded on gitter.

this.registerRegistry[name] = [deps, declare];
return register(deps, declare);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you make this return register.call(this, [], function () { return {}; }); that would effectively provide an "empty module" value for the bundle itself.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense… more or less, anyway!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How do I get the actual module to execute?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As in the test case, it's a layered import process, alternatively the bundle can be loaded with a <script> tag too.

In SystemJS 1.0 we use bundle configuration to create the relation and do this automatically... such an extra could be created for SystemJS 2.0 certainly. See https://github.com/systemjs/systemjs/blob/0.21/docs/config-api.md#bundles.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, that's really helpful. I'll try to do that and make sure this edit works and then update the PR.

@paulmelnikow
Copy link
Contributor Author

Is there anything else I can do to help get this merged?

@paulmelnikow
Copy link
Contributor Author

Hey @guybedford, could this be merged and released? I've pulling it in via git but am running into some toolchain issues on Zeit Now.

@guybedford
Copy link
Member

@paulmelnikow thanks for the ping. I'm slowly getting back into things here but will aim to put time aside for a SystemJS release next week.

@guybedford guybedford merged commit 156853c into systemjs:master Jan 11, 2019
@guybedford
Copy link
Member

Thanks again for the PR here, and apologies for the delay :) Will aim to release shortly.

@paulmelnikow paulmelnikow deleted the named-register-fix branch January 11, 2019 23:14
@guybedford
Copy link
Member

Published in 2.1.2.

paulmelnikow added a commit to mathisonian/react-editable-svg-label that referenced this pull request Jan 12, 2019
paulmelnikow added a commit to mathisonian/react-editable-svg-label that referenced this pull request Jan 12, 2019
@paulmelnikow
Copy link
Contributor Author

Thank you!

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

Successfully merging this pull request may close these issues.

2 participants