Gatsby Training
  • About this training
  • Fundamentals
    • React
    • Gatsby
    • GraphQL
    • JAMStack
    • JSX
    • Webpack
  • Getting Started
    • Build your first Gatsby site
    • Project structure
    • Component structure
  • Components
    • About Components
    • Eyebrow
    • Button
    • Heading
    • Working with CSS
    • Movie Card
  • Gatsby Core Components
    • Gatsby Link
    • Gatsby Image
  • Data and GraphQL
    • Data sources
    • Connecting a data source
    • Using the GraphQL playground
  • CreatePages
    • createPages Function
    • Create a template
  • Resources
    • Gatsby and React Resources
    • Other resources
Powered by GitBook
On this page

Was this helpful?

  1. Fundamentals

Webpack

PreviousJSXNextBuild your first Gatsby site

Last updated 4 years ago

Was this helpful?

is a static module bundler, in other words a software that collects chunks or modules of JavaScript and compiles them into one or more optimized bundles. Webpack is one of the core software packages that underpins Gatsby.

Webpack works by creating a dependency graph. In other words, webpack determines which modules depend on other modules to make your site work. A module is a chunk of code that encapsulates some functionality. It may be as small as a single JavaScript function, or it may be an entire library such as .

Notable uses of Webpack:

  • Optimize how CSS and JavaScript are delivered to the browser. Webpack supports a feature known as . Code splitting allows you to divide your code across a few bundles that are loaded as needed or as requested. Gatsby is already configured to use this feature. You do not have to do any additional set up to reap the benefits.

Add support for features such as Gatsby does not support Sass/SCSS out of the box, so you can , or use one of the contributed by the community.

Further reading:

Webpack
React
code splitting
Sass/SCSS
add a custom webpack configuration
Gatsby plugins
https://webpack.js.org/