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.
Common errors
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');
Warnings
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');
Install
npm install next-plugin-custom-babel-config yarn add next-plugin-custom-babel-config pnpm add next-plugin-custom-babel-config Imports
- withCustomBabelConfigFile wrong
import withCustomBabelConfigFile from 'next-plugin-custom-babel-config';correctconst withCustomBabelConfigFile = require('next-plugin-custom-babel-config');
Quickstart
const path = require('path');
const withCustomBabelConfigFile = require('next-plugin-custom-babel-config');
module.exports = withCustomBabelConfigFile({
babelConfigFile: path.resolve('../babel.config.js')
});