Skip to content

Incorrect bundle paths when bundles are in multiple directories.  #506

@Undistraction

Description

@Undistraction

Issue description

Where bundles are output to more than one directory, bundle paths are incorrect.

I'm using webpack-bundle-analyser with Gatsby via gatsby-plugin-webpack-bundle-analyser-v2 which is a very thin plugin. Gatsby adds bundles to /public/, however another plugin I use gatsby-plugin-netlify-cms adds bundles to /public/admin/. When BundleAnalyzerPlugin derives the bundleDir it resolves (using this.compiler.outputPath to /path/to/public/admin/ which it then uses as a prefix for all bundle paths. This means only the bundles that are generated to /admin/ are correct. The rest are not and result in warnings:

Error parsing bundle asset "/Users/me/Sites/www/public/app.js": no such file

It seems the current architecture can't handle situations where bundles are in written to different locations.

Technical info

  System:
    OS: macOS 12.3.1
    CPU: (12) x64 Intel(R) Core(TM) i9-8950HK CPU @ 2.90GHz
    Memory: 133.81 MB / 32.00 GB
    Shell: 3.2.57 - /bin/bash
  Binaries:
    Node: 14.18.2 - ~/.nvm/versions/node/v14.18.2/bin/node
    Yarn: 1.22.17 - /usr/local/bin/yarn
    npm: 6.14.15 - ~/.nvm/versions/node/v14.18.2/bin/npm
    Watchman: 2021.11.15.00 - /usr/local/bin/watchman
  npmPackages:
    gatsby-plugin-webpack-bundle-analyser-v2: ^1.1.26 => 1.1.26 

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions