gatsbyjs / gatsby

The best React-based framework with performance, scalability and security built in.
https://www.gatsbyjs.com
MIT License
55.13k stars 10.33k forks source link

Bundle splitting per page with createPages API stopped working after updating to Gatsby 4.5.0 #39022

Open davidhoneyb opened 1 week ago

davidhoneyb commented 1 week ago

Preliminary Checks

Description

After updating Gatsby from 4.4.0 to 4.5.0, the bundle split per page functionality stopped working. We use the createPages API to create pages dynamically. We expected each page to have its own bundle, but now it appears that the entire app is bundled together when running gatsby build.

Reproduction Link

https://github.com/HoneyBook/gatsby-minimal-reproduction

Steps to Reproduce

  1. Clone the minimal reproduction repository: https://github.com/HoneyBook/gatsby-minimal-reproduction
  2. Install dependencies: npm install
  3. Build the project: npm run build
  4. Observe the bundle splitting behavior in the build output.

Expected Result

Each page should have its own bundle as it did in Gatsby 4.4.0.

Actual Result

The entire app is bundled together, and bundle splitting per page is not working in the build output.

image

Environment

System:
    OS: macOS 14.4.1
    CPU: (10) arm64 Apple M1 Max
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 20.9.0 - ~/Library/Caches/fnm_multishells/56387_1719134227025/bin/node
    Yarn: 1.22.19 - ~/.nvm/versions/node/v14.19.3/bin/yarn
    npm: 10.1.0 - ~/Library/Caches/fnm_multishells/56387_1719134227025/bin/npm
  Browsers:
    Firefox: 113.0.2
    Safari: 17.4.1
  npmPackages:
    gatsby: ^5.13.5 => 5.13.6 
    gatsby-link: ^5.13.1 => 5.13.1 
    gatsby-plugin-breakpoints: ^1.3.11 => 1.3.11 
    gatsby-plugin-eslint: ^4.0.4 => 4.0.4 
    gatsby-plugin-manifest: ^5.13.1 => 5.13.1 
    gatsby-plugin-offline: 5.10.1 => 5.10.1 
    gatsby-plugin-react-helmet: 5.10.0 => 5.10.0 
    gatsby-plugin-react-i18next: 1.2.2 => 1.2.2 
    gatsby-plugin-react-svg: ^3.3.0 => 3.3.0 
    gatsby-plugin-sass: 5.10.1 => 5.10.1 
    gatsby-plugin-sitemap: 5.10.1 => 5.10.1 
    gatsby-plugin-split-css: ^2.0.3 => 2.0.3 
    gatsby-plugin-webfonts: ^2.3.2 => 2.3.2 
    gatsby-plugin-webpack-bundle-analyser-v2: 1.1.26 => 1.1.26 
    gatsby-source-filesystem: ^5.13.1 => 5.13.1 
    gatsby-transformer-gitinfo: ^1.1.0 => 1.1.0

Config Flags

No response