urish/angular-moment

Main attribute in package.json

okayawright opened this issue · 4 comments

Can you please add the attribute:
"main": "angular-momentjs.js"
in your package.json so that some modules like node-resolve for Gulp https://github.com/substack/node-resolve can find the entry point in your component.
Cheers.

urish commented

yes, can you please send a PR for that?

thanks,
Uri

On Sun, Jul 3, 2016 at 5:04 PM, okay_awright notifications@github.com
wrote:

Can you please add the attribute:
"main": "angular-momentjs.js"
in your package.json so that some modules like node-resolve for Gulp
https://github.com/substack/node-resolve can find the entry point in your
component.
Cheers.


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
#257, or mute the thread
https://github.com/notifications/unsubscribe/AA2dnn3TA_7iXhThvkcmZh0gwtEHIKDUks5qR8-GgaJpZM4JD4rA
.

Imo better will be to follow with what other are doing.

ngAria, ngMaterial, ngAnimate all have index.js as main like:

require('./angular-animate');
module.exports = 'ngAnimate';

This will initalise module and provide a name to be used in module definition like:

import ngAnimate from 'angular-animate';

angular.module('myApp' , [
 ngAnimate
]);

This shuld also work for commonjs, es6, browserity.

urish commented

The package.json entry is there

But it do not export name of module. There no simple way to use this module with clj or ES modules.
Angular1 have this silly convention of adding modules by name and hoping that they are available in runtime. When used with with ESModules I would like to:

import ngMoment from 'angular-moment';

angular.module('myApp', [
    ngMoment
]);

I pointed to ngAnimate solution that is widely used in core. For CLJ and ES Modules what is needed is name of module not module itself.

I can see in release notes that for AMD module name is exported, it would be also the case for CJS?