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

Add section on package requirements to importSync documentation #1096

Merged
merged 1 commit into from
Feb 3, 2022

Conversation

jrjohnson
Copy link
Contributor

Hopefully this will save someone else some time, especially the bit
about ember-auto-import being required.

Refs #1091

@lifeart
Copy link
Collaborator

lifeart commented Feb 1, 2022

I think it's also could be build-time runtime assert, if importSync is found, we could check for deps

@ef4
Copy link
Contributor

ef4 commented Feb 2, 2022

This isn't quite correct.

If the package-being-imported is an ember addon, then you don't need ember-auto-import.

And if the package-doing-the-import is a v2-formatted addon, then you also don't need ember-auto-import, regardless of whether the package-being-imported is an ember addon.

The real rule here is that the argument to importSync should mean the exact same thing as the argument to plain old import. You can't import from NPM without ember-auto-import, so you can't importSync from NPM without ember-auto-import either. It's not that there's a special rule for importSync, it's that it follows the prevailing rules.

@ef4
Copy link
Contributor

ef4 commented Feb 2, 2022

So my suggestion for this PR is to word it more as a hint. Something like: "Remember that Ember apps can only import from non-ember-addon NPM packages if they have ember-auto-import, and that rule still applies to importSync".

Hopefully this will save someone else some time, especially the bit
about ember-auto-import being required.
@jrjohnson
Copy link
Contributor Author

Thanks for the feedback @ef4. I've updated the language a bit. I didn't use your exact verbiage because I'm not sure this is a "reminder" for most ember devs, it certainly wasn't for me as I don't really know how embroider and ember-auto-import are expected to interact.

@ef4
Copy link
Contributor

ef4 commented Feb 3, 2022

Looks good, thanks.

@ef4 ef4 merged commit 7eba4a9 into embroider-build:main Feb 3, 2022
@ef4
Copy link
Contributor

ef4 commented Feb 3, 2022

And yes, I appreciate you making the wording more broadly approachable. It's helpful when people contribute to the docs who haven't been stewing so long in the code that they forget what parts are tricky. 😄

@jrjohnson
Copy link
Contributor Author

Thanks for stewing long enough to make something awesome!

@jrjohnson jrjohnson deleted the import-sync-docs branch February 8, 2022 18:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants