02 / 02

How do we use loader in our app?

Webpack only understands JavaScript and JSON files. Loaders allow webpack to process other types of files and convert them into valid modules that can be consumed by your application and added to the dependency graph.

There are two ways to use loaders in your application:
  1. 1

    Configuration (recommended): Specify them in your webpack.config.js file.

  2. 2

    Inline: Specify them explicitly in each import statement.

It's possible to specify loaders in an import statement, or any equivalent 'importing' method. Separate loaders from the resource with !. Each part is resolved relative to the current directory.