Resolved the issue.
If anyone comes across this in future it’s because we aren’t doing a compilation of the packages. Because of this and the under the hood mechanisms it’s throwing exceptions as we aren’t telling Builder IO and NextJS to transpile our packages.
In order to resolve this, this is the full config we added in the end:
const nextConfig = withBuilderDevTools({
webpack: (config) => {
config.module.rules.push({
test: /\.(js|jsx)$/,
exclude: /node_modules/,
use: ['babel-loader'],
});
return config;
},
transpilePackages: [
'<Package One>',
'<Package Two>',
'<Package Three>',
],
});