I am using Babel in my project. The thing is, I have this line of code in my server.js:
import schema from "./data/schema"; (data/schema.js is in ES2015 syntax).
And when I am trying to compile my server.js with babel, like this:
babel -o server_production.js --minified server.js it produces a new file without errors and replaces import instruction with require. But the thing is, when I am trying to run my babel-compiled server.js with node, it complains about data/schema.js, because it wasn't transpiled into ES5, only required (the exact error is Unexpected token "import", because I am using some other imports in data/schema.js).
So, the question is: how can I compile my file and all the files it imports into one file? I tried babel -o server_production.js --minified data/schema.js server.js, but that didn't work either.