javascriptwebpackbuildbabeljsbabel-loader

why babel-loader is part of webpack instead babel itself?


I am learning about how build system works in JavaScript. If babel-loader is transpiler that translates React to JavaScript, why is it part of webpack plugin?

Isn't transpiling and bundling is a separate process?

And is there a resource that explain how all this frameworks fit together and make build system work in detail? I seem to only find high level overview at the official docs.


Solution

  • Isn't transpiling and bundling is a separate process?

    Yes. That is why we have "webpack the bundler", and "Babel the compiler/transpiler", and babel-loader to connect the two together. Without babel-loader webpack would not be able to process files through Babel.

    Hope that helps.