'When using babel-loader with webpack, does babel-loader transpile code differently than when using Babel directly?
Are the defaults the same? Do they have different targets? Is babel-loader contingent on webpacks targets?
Reason I ask is I am using babel-loader with webpack and when running in production mode, the code is being transpired correctly, expect the const keyword, that word is not being changed to 'var'. However when transpiling with babel directly on the file using babel and not babel-loader through webpack, the output obviously is changing the const keyword to var.
The only time it transpiles const to var, is when I set the webpack.config.js file to have
target: ["web", "es5"] however, I feel that should not matter, since babel-loader is just loading the transpiled code from the babel runtime...right? Which contains the var keyword. Or is it not?
What is babel-loader doing different than when running babel on the file directly?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
