-
Notifications
You must be signed in to change notification settings - Fork 786
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
CommonJS and AMD module names are different #399
Comments
I understand, but in TypeScript, you must statically define the module name, so this module name discrepancy is an issue. At DefinitelyTyped project the convention is to use the npm package name as module name, but this makes it unusable in browser. |
the npm name interact.js also conflicts with bundlers like the ones used in aurelia because it assumes it's looking for a js file instead of an npm module |
I'll see if @chrisdickinson would be okay with giving us the |
interactjs is fine it just can have a "."
On Mon, Nov 28, 2016 at 5:30 PM -0500, "taye" <[email protected]> wrote:
I'll see if @chrisdickinson would be okay with giving us the interact package name. If he's not, what do you think would be a good alternative to use?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.
|
|
My original issue is still not resolved though: AMD module name is still interact, and not interactjs like the CommonJS module name. |
I've exchanged some emails with [email protected]. Something should happen soon maybe. |
@elektromodulator, @machineghost The trendy thing seems to be to use an "@" in the module name if there's a conflict. Since Angular does this and is written in TypeScript, I presume that this would be an optimal solution. |
"@" starting names are scope names in NPM. |
How does your setup handle anonymous AMD modules and would that be an appropriate solution? |
I just noticed that the |
I'll try it tomorrow, if I have the time (too busy lately :( ). |
The inconsistency problem between AMD and CommonJS names could have been solved without renaming the project. If someone is working with code that assumed the CommonJS name and then must work in an AMD environment, it can be solved with a map configuration in RequireJS:
This means "everywhere where someone requests the module named SystemJS also supports making such mapping. The reverse mapping would also be possible if someone started using the AMD name and the must work with the CommonJS name. Ultimately, it would be preferable to just avoid hardcoding the name in the |
CommonJS module name is "interact.js" (as defined in package.json), but AMD module name is "interact".
I think it should be consistent in all environment.
This also creates a problem in language bindings, as module name is dependent on the environment.
For example in DefinitelyTyped's interact.d.ts it is defined as "interact.js", which makes it unusable for browser projects.
The text was updated successfully, but these errors were encountered: