Open Undistraction opened 2 years ago
Hmm this does sound complicated and a likely bug. Would you be able to create a small reproduction so it would be possible to fix this at some point?
Hi, I can confirm this.
Here a part of json I have:
"children": [{
"hash": "acbf87df4bf149c73cd1",
"version": "5.65.0",
"time": 28955,
"builtAt": 1652089618297,
"publicPath": "/assets/static/",
"outputPath": "/app/public/assets/static",
"assetsByChunkName": {
"static:fonts": ["style/fonts-acbf87df4bf149c73cd1.css", "js/fonts-0a26b8e32bf029c9d244c1cd344336a5.js"],
"static:pdf-availability": ["style/pdf-availability-acbf87df4bf149c73cd1.css", "js/pdf-availability-6a5493c1496fd7e44b08a976c90cd01a.js"],
"static:pdf": ["style/pdf-acbf87df4bf149c73cd1.css", "js/pdf-801d6111f8a308117ba0f8c07cc16d37.js"]
},
Warning for the file:
Error parsing bundle asset "/app/public/assets/js/pdf-availability-6a5493c1496fd7e44b08a976c90cd01a.js": no such file
It seems it ignores the publicPath
?
Please create a small reproduction case
I'l try 👍 Thank you for your time
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/
. WhenBundleAnalyzerPlugin
derives thebundleDir
it resolves (usingthis.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:It seems the current architecture can't handle situations where bundles are in written to different locations.
Technical info