generator-gulp-angular icon indicating copy to clipboard operation
generator-gulp-angular copied to clipboard

JS object dynamic key causes error in plugin 'gulp-angular-filesort'

Open d4lek opened this issue 10 years ago • 2 comments

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 }

d4lek avatar May 11 '16 16:05 d4lek

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.

Swiip avatar May 11 '16 17:05 Swiip

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

d4lek avatar May 12 '16 08:05 d4lek