// comments in anonymous functions break React code #11304
Labels
Has PR
i: bug
i: regression
outdated
A closed issue/PR that is archived due to age. Recommended to make a new issue
pkg: generator
I'm submitting a bug report
Webpack Version:
4.42.0
Babel Core Version:
7.9.0
Babel Loader Version:
8.1.0
Please tell us about your environment:
OSX 10.14
Current behavior:
After running yarn build in create-react-app following code transpiles to wrong JS code:
Transpiled and packed:
(arrow added)
render()
has danglingreturn
(line break after comment), so JS adds semicolon there - function returns undefined.When setting
compact: false
in loader options this behavior isn't observedExpected/desired behavior:
babel-loader should keep parens in arrow functions, following code is valid JS
Here's ejected react-create-app with reproduction
https://github.com/jakub-gonet/babel-loader-comment-bug
Run
yarn build && serve -s build
(assuming serve is installed)When changing compact to false in
webpack.config.js#351
it works correctlyEDIT:
also reproduces this issue.
The text was updated successfully, but these errors were encountered: