-
Notifications
You must be signed in to change notification settings - Fork 605
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
Simplify Module IDs in Isomorphic Packages #672
Comments
Hi @mwistrand, thanks for filing this issue. I see your pain, thanks for the explanation. You suggested to rename AMD |
Thanks for responding so quickly, @rxaviers. Yes, changing the Cldr.js module ID from |
Your proposed changes look good to me. One problem I see though is that the
We should assess the pros and cons of doing that versus releasing individual packages like |
I apologize for the delay in responding. Yes, changing
Personally, I would be fine with relying on individual packages; my main concern is being able to use the same module id in both CommonJs and AMD environments. |
@mwistrand would you be interested in submitting a PR with necessary changes here and in cldrjs?
@jzaefferer @scottgonzalez, do you have any suggestion about it please? |
Seems fine for a 2.0.0 release. I'd just say make sure you've dealt with all the issues so that you don't need to do another major release for some other set of module loader problems. Other than that, I don't have much to say; you know how I feel about all these tools... |
Thanks for your input @scottgonzalez and yeap I know 😝 |
Yes, I'm happy to start working on it.
To be fair, this isn't a question of adding support for an additional tool, but rather one of improving support for a tool that Globalize.js already supports. That said, given what these changes mean for existing users, I had no expectation that they would be included in a minor release. |
I have a package that utilizes Globalize.js, and is intended be used in either a CommonJS (Node) or AMD (browser) environment. While it is easy to load everything I need in either environment alone, getting Globalize.js to load correctly in both environments simultaneously is more invovled.
Since the AMD portion of the UMD wrapper references the Cldr.js under the
cldr
package, additional mappings in the loader configuration are needed to redirectcldr
references back to thecldrjs
directory so that Node.js doesn't choke when loading thecldr/unresolved
that's required in browser environments. In this particular instance, the additional mappings would not be necessary ifcldrjs
were used as the package ID instead ofcldr
.Further, loading the modules underneath
globalize/dist/globalize/
with the IDsglobalize/message
,globalize/date
, etc. is easy in an AMD environment with the right loader config. Node, on the other hand, cannot resolve those simplified IDs. As such, the full path is needed to resolve those IDs in both Node and the browser (e.g.,require('globalize/dist/globalize/message')
). Using the full paths certainly works, but in the long run it would be ideal to use the simplified IDs that do not reference the directory structure.The text was updated successfully, but these errors were encountered: