I am trying to transpile a set of js files.As babel by default operates in a strict mode,it outputs a syntax error whenever there is a conflict for example use of a delete keyword.The solution I am looking for is to somehow ignore this strict mode. Please note that I am doing above operation using babel cli and that there is no project set-up.
Edit: I am aware of how delete works in strict mode.The question is to use babel to operate in non-strict mode so that it won't give errors as by default it parses files as ES6 modules.

I have figured out the solution.By default Babel parses the files as ES6 modules, which are strict by default.If we add the --source-type script in case one is using cli,then it will work.I am writing a simple command to transpile a single js file which will ignore strict mode,in case someone gets stuck on this in future.One key note is you need to upgrade to latest babel 7 to make it work.
babel test.js --presets=@babel/env --source-type script --out-file test_new.js
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With