JS object dynamic key causes error in plugin 'gulp-angular-filesort'
Hi all,
So I encountered this issue. I need to set a dynamic object key value, it works while gulp is serving, but once I stop serving and restart, or do gulp build it brings up following error:
[AngularFilesort] Error in plugin 'gulp-angular-filesort' Error in parsing: "templates/design/manage_labels.js", Line 146: Unexpected token [
Is there a way to fix this or does anyone have a solution for this? Query looks like this:
vm.query = { [keyword]: vm.addNewLabel }
Not a solution but some elements: Angular filesort is a plugin we use to sort files injection for them to be rightfuly ordered. It uses a ES parser which obviously can't understand this syntax. Try looking for an update of this plugin. If you use Babel, I think this plugin happens after Babel. I suppose Babel suppose this has not to be compiled but perhaps it exists a plugin to force transpilation for this.
Okay so Angular filesort update did solve the issue but then I hit another gulp-uglify failure. My solution to this problem was assigning dynamic object variable in a different fashion as follows if someone is interested:
var query = {}; query[keyword] = vm.addNewLabel;
Cheers