I'm submitting a bug report
- JSPM OR Webpack AND Version
webpack 5.90.3
Current behavior:
I'm using Webpack 5 with new AureliaPlugin({dist: "es2015}) and typescript target: "es6".
This config causes a runtime error when using arrow functions with a block body as accessor functions:
Inner Error:
Message: Unable to parse accessor function:
(model) => {
return model.name;
}
Inner Error Stack:
Error: Unable to parse accessor function:
(model) => {
return model.name;
}
at getAccessorExpression (webpack-internal:///aurelia-validation:569:15)
at PropertyAccessorParser.parse (webpack-internal:///aurelia-validation:552:30)
at FluentEnsure.ensure (webpack-internal:///aurelia-validation:1651:44)
at ValidationRules.ensure (webpack-internal:///aurelia-validation:1715:58)
Workaround: instead of using
// failing accessor function
.ensure((model) => {
return model.name;
})
it is possible to use the old fashioned style or the one-liner
// working accessor functions
.ensure(function(model) {
return model.name;
})
.ensure((model) => model.name)
Expected/desired behavior:
- What is the expected behavior?
Update arrow function regex to allow arrow functions with a function body. This could be handy to support automatically formatted code.
|
const arrow = /^\(?[$_\w\d]+\)?\s*=>\s*[$_\w\d]+\.([$_\w\d]+)$/; |
I'm submitting a bug report
Library Version:
2.0.0
Operating System:
Windows 10
Node Version:
20.11.1
10.2.4
webpack 5.90.3
Browser:
all
Language:
TypeScript 5.4.2
Current behavior:
I'm using Webpack 5 with
new AureliaPlugin({dist: "es2015})and typescripttarget: "es6".This config causes a runtime error when using arrow functions with a block body as accessor functions:
Workaround: instead of using
it is possible to use the old fashioned style or the one-liner
Expected/desired behavior:
Update arrow function regex to allow arrow functions with a function body. This could be handy to support automatically formatted code.
validation/src/property-accessor-parser.ts
Line 33 in f1628a3