Prismic Team:
I noticed when I analysed the production built that the package buffer is loaded.
When I checked the dependencies, slice-ui-machine was reported as being dependent on it. slice-ui-machine is however only added under devDependencies. Why is buffer loaded in production builts?
yarn why v1.22.10
[1/4] Why do we have the module "buffer"...?
[2/4] Initialising dependency graph...
[3/4] Finding dependency...
[4/4] Calculating file sizes...
=> Found "buffer@5.7.1"
info Has been hoisted to "buffer"
info Reasons this module exists
- Hoisted from "slice-machine-ui#puppeteer#unbzip2-stream#buffer"
- Hoisted from "slice-machine-ui#puppeteer#tar-fs#tar-stream#bl#buffer"
info Disk size without dependencies: "96KB"
info Disk size with unique dependencies: "140KB"
info Disk size with transitive dependencies: "140KB"
info Number of shared dependencies: 2
=> Found "bl#buffer@6.0.3"
info This module exists because "slice-machine-ui#ora#bl" depends on it.
info Disk size without dependencies: "104KB"
info Disk size with unique dependencies: "148KB"
info Disk size with transitive dependencies: "148KB"
info Number of shared dependencies: 2
Done in 0.54s.
It's a dependency coming from Ora (a tool we used to display stuff in the terminal). At some point in older versions, we had Ora installed with Slice Machine UI, but we removed it a long time ago.
Could you tell me which version of Slice Machine you are using?
I'm currently using slice-machine-ui v0.3.8. I know it's not the latest version, but the recent "minor" upgrades caused quite often breaks which I currently don't have resources for to handle.
I upgrade slice-machine-ui to 0.4.2. Buffer is still loaded. I guess the fix you mentioned either didn't happen at all or it was unrelated to the buffer package.
just to clarify. My project doesn't use any feature from NextJS that requires the dependency on buffer. Yes, puppeteer also requires buffer and is only needed by slice-machine-ui. So, in short, in my case, puppeteer is only needed due to slice-machine-ui.
As for the warning. I DO NOT get any warnings. My issue is that slice-machine-ui is a devDependency and is therefore not any bundles in prod. Buffer however is included in the bundles in production and I don't see any reason why it should be. It's increasing the bundle of my app unnecessarily.