next-plugin-custom-babel-config

raw JSON →
1.0.5 verified Sat Apr 25 auth: no javascript deprecated

A Next.js plugin that resolves a custom babel config file (e.g., babel.config.js) for monorepo setups using yarn workspaces. Current stable version is 1.0.5, last published in 2020. It works with Next.js >7.0.0 but is broken on Next.js 11+. The plugin is no longer maintained; PRs for fixes are welcome. Key differentiator: enables project-wide babel configuration in monorepos where sharing a single babel.config.js is needed.

error Error: Cannot find module 'next-plugin-custom-babel-config'
cause Package not installed or installed only as devDependency.
fix
Run npm install next-plugin-custom-babel-config --save
error TypeError: withCustomBabelConfigFile is not a function
cause Using ES6 import syntax instead of CommonJS require.
fix
Change to const withCustomBabelConfigFile = require('next-plugin-custom-babel-config');
deprecated Plugin is no longer maintained and is broken with Next.js 11+.
fix Consider using Next.js built-in babel configuration via .babelrc or babel.config.js in root, or migrate to a supported plugin.
gotcha The plugin only supports CommonJS require() and does not work with ESM import.
fix Use const withCustomBabelConfigFile = require('next-plugin-custom-babel-config');
npm install next-plugin-custom-babel-config
yarn add next-plugin-custom-babel-config
pnpm add next-plugin-custom-babel-config

Shows how to wrap Next.js config with custom babel config file path resolution.

const path = require('path');
const withCustomBabelConfigFile = require('next-plugin-custom-babel-config');

module.exports = withCustomBabelConfigFile({
  babelConfigFile: path.resolve('../babel.config.js')
});