You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The wide-spread convention for modular Angular workflow is
angular.module('appName', [require('module-name')]);
// instead of
// require('module-name');
// angular.module('appName', ['moduleName']);
So exported string is used only in the context of require or import, and __root["module-name"] =could be safely omitted if exportPackage.standalone === ''.
The checks for exportPackage.amd and exportPackage.commonjs could be added for consistency as well, but I see no possible use for that.
Can we do that?
The text was updated successfully, but these errors were encountered:
I think it would be better to add this to a new export style instead of modifying UMD. I'm a bit afraid because Angular 2 is coming, and this option would become useless in the future. I could see some value in adding customization support, for instance by templates or something like that. What would you think of that? Or maybe something like this:
It is a common case for any plugin/modular bundle, jQuery plugins are similar. They may have something to export, but in global scope they won't expose everything outside jQuery. There are a few ones that exploit UMD template like that.
Angular 2 is totally different beast, I wouldn't worry about the future of 1.x for the next 2-3 years. But yes, the things are going to change for 1.x, I guess that angular.module hardly requires any special treatment from module bundler, the same thing can be done now with ES7/TS decorators but in more conventional way.
Anyway, customisable UMD template with logic (i.e. EJS) would be advantageous in this case imo.
This would be beneficial because it tends to pollute globals even when it is unncessary.
The possible case is Angular module, e.g.
The wide-spread convention for modular Angular workflow is
So exported string is used only in the context of
require
orimport
, and__root["module-name"] =
could be safely omitted ifexportPackage.standalone === ''
.The checks for
exportPackage.amd
andexportPackage.commonjs
could be added for consistency as well, but I see no possible use for that.Can we do that?
The text was updated successfully, but these errors were encountered: