I am trying to set up Babel compiler which converts ES6 and higher Javascript syntax to ES5. However, I faced one weird problem, when it converts to ES5 adds "use strict" in the top of the line, since the whole project is not written in strict mode it causes errors. I would like to disable this functionality. I have seen a couple of solutions online but none of them worked for me. I followed these steps link but did not work.
This is how my package.json
looks like:
{
"name": "webplatform",
"version": "1.0.0",
"description": "Web interface Platform",
"scripts": {
"build": "babel htdocs/es6 -d htdocs/js"
},
"author": "harry",
"license": "ISC",
"devDependencies": {
"@babel/cli": "^7.4.3",
"@babel/core": "^7.4.3",
"@babel/plugin-transform-strict-mode": "^7.2.0",
"@babel/preset-env": "^7.4.3"
}
}
And .babelrc
is here
{
"presets": ["@babel/preset-env"],
"plugins": [
["@babel/plugin-transform-strict-mode", {
"strict": false
}]
]
}
When I run the command npm run build
it converts everything fine just "use strict" is messing me up :(