Use of angular-ui-sortable in es6 modules
Closed this issue · 2 comments
Hey,
I want to use angular-ui-sortable in es6 modules.
Like so,
import angular from 'angular';
import uiSortable from 'angular-ui-sortable';
export default angular.module('abc', [uiSortable]);
Doing this, I am getting below error:
Failed to instantiate module {} due to: Error: [ng:areq] Argument 'module' is not a function, got Object
I am using webpack to bundle packages.
If I use it as export default angular.module('abc', ['ui.sortable']);
, webpack will not bundle angular-ui-sortable package as a whole due to 'tree shaking'.
Please provide suggestions. I am not using webpack.config.js file directly, Its part of a scaffold, I am using.
The reason you got those errors is you didnt import the module in a right way.
As you can see in the sourceCode. It does not export any es6 modules or something like that. Therefore, if you really want to use angular-ui-sortable module, what you can do here is
import 'angular-ui-sortable';
export angular.module('abc', ['ui.sortable']);