7

Minification fails when I try to use Ecmascript-6 features in my app.

If i try to use an arrow function:

$.get('/clients/all').done(response => {
  // Do something with the response
})
 

I get the following error:

/* Minification failed. Returning unminified contents.
(8,45-46): run-time error JS1195: Expected expression: >
(36,6-7): run-time error JS1195: Expected expression: )
(37,1-2): run-time error JS1002: Syntax error: }
 */

And so on with other ES6 features.

Do you know an ItemTransform for ES6?

1 Answer 1

1

Still there is no .NET bundling package for ES6+.

But as a workaround you can use: babeljs.io > Try It Out > Presets: ES2015.

The following code:

var gridNames = Enumerable.From(verifiedKeys).Select(x => `demo_${x}`).ToArray();

Will be translated into:

var gridNames = Enumerable.From(verifiedKeys).Select(function (x) {
  return "demo_" + x;
}).ToArray();

Link: https://babeljs.io/repl and check: Presets > ES2015.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.