Skip to content

Latest commit

 

History

History
87 lines (71 loc) · 5.2 KB

File metadata and controls

87 lines (71 loc) · 5.2 KB
title Loaders
sort -1
contributors
simon04
bajras
rhys-vdw
EugeneHlushko
hemal7735
snitin315
anshumanv
jamesgeorge007
chenxsan

Understanding Loaders

Loaders are transformations that are applied to the source code of a module. They allow you to pre-process files as you import or "load" them.

  • Transformation: Loaders can convert files from a different language (like TypeScript) to JavaScript.
  • Assets: They allow you to include resources like images or CSS directly in your JavaScript dependency graph.
  • Chaining: You can chain multiple loaders together (e.g., sass-loader -> css-loader -> style-loader).

Webpack enables use of loaders to preprocess files. This allows you to bundle any static resource way beyond JavaScript. You can easily write your own loaders using Node.js. Loaders are separate packages that extend webpack's capabilities and are maintained within the broader ecosystem. Loaders are activated by using loadername! prefixes in import .. from "mod";/require() statements, or are automatically applied via regex from your webpack configuration – see configuration.

Files

  • ref-loader Create dependencies between any files manually

JSON

Transpiling

Templating

Styling

Frameworks

Awesome

For more third-party loaders, see the list from awesome-webpack.