Your code snippet employs browserSync and http-proxy to create a proxy server. However, running babel proxy.js --out-file proxified.js yields only a copy of the original file.
Babel, a transformation framework, has undergone a change in default behavior from pre-6.x versions. Previously, specific transformations were enabled by default, but current versions require explicit configuration.
To specify transformations, you need:
{ "presets": [ "env" ] }
The "env" preset compiles standard ES* behavior to ES5. If your Node version supports ES6 features, consider using the following .babelrc to process only unsupported features:
{ "presets": [ ["env", { "targets": { "node": "true" } }] ] }
You can further customize targets if required for browser support.
The above is the detailed content of Why Is My Babel File Replicated Without Transformation?. For more information, please follow other related articles on the PHP Chinese website!