-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
Use consistent, specific imports #1221
Conversation
This module was using a mix of es6 and CommonJS exports when it clearly needs CommonJS. It has been updated to use CommonJS throughout.
This updates the entire package with consistent imports. Updating the imports to be file-specific instead of using the shorthand provides compatibility with all module loaders.
Initially, I'm not in favor of such a change. Although, I'd be curious to hear the motivation for this. FWIW, there are also some errors in the updates, such as export default from './TextArea/TextArea'
|
It would also appear we have neither linting nor tests around the index files :) |
The motivation behind this is to allow the package to load in browser-based module loaders like StealJS, which is based on SystemJS. I figured making a PR is the best solution to making it work everywhere. And while the loaders do allow you to create a configuration map of the files, I was hoping to avoid doing that. I'm also hoping to avoid having to switch back to Webpack to use the package. If I change the imports to go through the |
I've cleaned up those mistakes and switched to using the |
Current coverage is 95.89% (diff: 100%)@@ master #1221 diff @@
==========================================
Files 880 880
Lines 4901 4901
Methods 0 0
Messages 0 0
Branches 0 0
==========================================
Hits 4700 4700
Misses 201 201
Partials 0 0
|
I certainly want maximum interop for the lib. My ignorance is exposed regarding browser module loaders. I'll take a look at those and review this PR in light of that. Thanks for the work and extra explanation here. |
Note for the future. PRs opened from a branch on your fork will allow myself and the collaborators here to push updates to it. Though, this is not possible against your master branch. This is handy for fixing conflicts, lint issues, and tests, if needed. No need to reopen a new PR, just a note for the future 👍 Thanks again! |
I'm still not sure what problem this PR is solving. This project uses webpack internally as a build tool and the output of that is pushed up to How module importing is done internally within the |
Hi, I'm the maintainer of StealJS. As I understand from this discussion, the package.json main of |
I've previously implemented the I'd like to get this going, though, as it stands it seems there is either not full community agreement on the browser field spec, or, I am misunderstanding some part of it. |
Ah, I follow, webpack gives preference to the browser field. So we need a field that webpack will ignore. We actually have one for steal: |
Indeed, I'll take a look around and see if anyone has solved this yet. As far as webpack's implementation is concerned, the Without a clear spec nor solution at hand, I'm going to close this for now. It is not pretty, but as a workaround @marshallswain, you can import the full file path: import Container from 'semantic-ui-react/dist/commonjs/elements/Container' I'd also suggest discussing ES module support with @matthewp. We provide an |
Thanks @levithomason. I'll submit a PR for the mixed module syntax in the debug.js file. That's preventing me from being able to use it as you suggested above. |
This updates the entire package with consistent imports. Updating the imports to be file-specific instead of using the folder shorthand ensures compatibility with all module loaders.