Whenever I try compile my code for older browsers it Babel doesn’t work properly
Whenever I try compile https://github.com/zeondev/pluto down to work with older browsers I get this really annoying error from babel that is an actual error in the code.
It looks like this
SyntaxError: E:pluto_babelsrcnode_modules@babelplugin-proposal-private-property-in-objectlibindex.js: 'return' outside of function. (25:2)
23 | `);
24 |
> 25 | return;
| ^
26 | } catch (e) {}
27 |
28 | throw new Error(`
at constructor (E:[email protected]:351:19)
at Parser.raise (E:[email protected]:3233:19)
at Parser.parseReturnStatement (E:[email protected]:12597:12)
at Parser.parseStatementContent (E:[email protected]:12254:21)
at Parser.parseStatementLike (E:[email protected]:12223:17)
at Parser.parseStatementListItem (E:[email protected]:12203:17)
at Parser.parseBlockOrModuleBlockBody (E:[email protected]:12780:61)
at Parser.parseBlockBody (E:[email protected]:12773:10)
at Parser.parseBlock (E:[email protected]:12761:10)
at Parser.parseTryStatement (E:[email protected]:12669:23) {
code: 'BABEL_PARSE_ERROR',
reasonCode: 'IllegalReturn',
loc: Position { line: 25, column: 2, index: 1133 },
pos: 1133
}
Im running it using
babel src --out-dir dist
and my babel rc looks like
{
"presets": [
[
"@babel/preset-env",
{
"targets": {
"safari": "9"
}
}
]
]
}
Can anyone help?