HubSpot project builder often fails for random reasons

I’ve got a legacy app on platform v2023.2

Every time I upload it to HubSpot to build then it fails for some random reason. If I upload any previous commit that was working it still fails. An example error is

[ERROR]
 Sep 08 11:09:27AM BST [vite]: Rollup failed to resolve import "@kurkle/color" from "/tmp/cms_zVmz8S/cms-js-build/node_modules/chart.js/dist/chart.js".
[ERROR]
 Sep 08 11:09:27AM BST This is most likely unintended because it can break your application at runtime.
[ERROR]
 Sep 08 11:09:27AM BST If you do want to externalize this module explicitly add it to
[ERROR]
 Sep 08 11:09:27AM BST `build.rollupOptions.external`

But the specific error is not really important - it was working before but now cms-js-build doesn’t work, the build system seems to be stateful and broken. And if you manage to get this error to go away you’ll always get a new one. We’ve tried many AI fixes from HubSpot agent or ChatGPT etc.
I’ve tried creating new projects but that doesn’t fix it. Tried using platform 2025.1 and that doesn’t fix it.

However, very occasionally the build does work, for exactly the same code/commit that fails previously. But it’s random. It’s like there’s one HubSpot build agent that works with our project and the rest don’t for some reason.

I’ve tried raising this issue with support but they’ve sent me here.

The painful thing is now we have an issue in production which I can’t even look at fixing because I can’t get builds working. All despite not changing any code. And our customers are upset.

Hey @connortrrrr - thanks for posting in the Community!
I’d like to tag in some experts to see if they have any insight for us here! @dsmarion, @nickdeckerdevs1, and @Anton - any thoughts here?

HubSpot support shared a workaround: Add a vite.config.js file

// within a vite.config.js file
import { defineConfig } from "vite";
export default defineConfig({
 build: {
 rollupOptions: {
 maxParallelFileOps: 256,
 },
 },
});

Still not sure what the root cause is, i.e. when the HubSpot build system changed.

We removed the `vite.config.js` workaround by repalcing the `@tabler/icons-react` library