{"id":20158,"library":"js-config-webpack-plugin","title":"js-config-webpack-plugin","description":"A webpack plugin that provides pre-configured JavaScript loader configurations using Babel. Version 2.0.3 requires @babel/core, @babel/preset-env, @babel/preset-react, and webpack >=4.36. It automatically adjusts configuration based on webpack mode (development/production), supporting features like source maps, caching, and environment targets. Part of the common-config-webpack-plugin suite, it aims to simplify webpack loader setup by offering sensible defaults while allowing customization via babelConfigFile option.","status":"active","version":"2.0.3","language":"javascript","source_language":"en","source_url":"https://github.com/merkle-open/webpack-config-plugins","tags":["javascript","babel-loader","webpack","babel","js","loader","webpack-plugin"],"install":[{"cmd":"npm install js-config-webpack-plugin","lang":"bash","label":"npm"},{"cmd":"yarn add js-config-webpack-plugin","lang":"bash","label":"yarn"},{"cmd":"pnpm add js-config-webpack-plugin","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Babel compiler core","package":"@babel/core","optional":false},{"reason":"Modern JS transpilation preset","package":"@babel/preset-env","optional":false},{"reason":"React JSX support","package":"@babel/preset-react","optional":false},{"reason":"Webpack bundler","package":"webpack","optional":false}],"imports":[{"note":"Package is CJS-only; no default ESM export.","wrong":"import JsConfigWebpackPlugin from 'js-config-webpack-plugin';","symbol":"default","correct":"const JsConfigWebpackPlugin = require('js-config-webpack-plugin');"},{"note":"Not a named export; the plugin is the default export.","wrong":"import { JsConfigWebpackPlugin } from 'js-config-webpack-plugin';","symbol":"JsConfigWebpackPlugin","correct":"import JsConfigWebpackPlugin = require('js-config-webpack-plugin');"},{"note":"Must be instantiated with 'new' and placed in plugins array.","wrong":"JsConfigWebpackPlugin(options)","symbol":"usage","correct":"new JsConfigWebpackPlugin(options)"}],"quickstart":{"code":"// webpack.config.js (CJS)\nconst path = require('path');\nconst JsConfigWebpackPlugin = require('js-config-webpack-plugin');\n\nmodule.exports = {\n  mode: 'production',\n  entry: './src/index.js',\n  output: {\n    path: path.resolve(__dirname, 'dist'),\n    filename: 'bundle.js',\n  },\n  plugins: [\n    new JsConfigWebpackPlugin()\n  ]\n};","lang":"javascript","description":"Basic webpack config using js-config-webpack-plugin with default Babel presets and production mode."},"warnings":[{"fix":"Upgrade to webpack >=4, Babel >=7, and install @babel/preset-react as a dependency.","message":"Version 2.x drops support for webpack <4 and Babel <7. Requires @babel/preset-react even if not using React.","severity":"breaking","affected_versions":">=2.0.0"},{"fix":"Either remove custom .babelrc or explicitly set babelConfigFile option to the intended file.","message":"The plugin automatically searches for a .babelrc file in the project root. If an unexpected .babelrc exists, it may override the plugin's defaults and cause different transpilation behavior.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Use with webpack 4 or manually override peer dependencies; monitor for webpack 5 support.","message":"As of webpack 5, the `webpack` property in peerDependencies may cause warnings. The package has not been officially updated for webpack 5.","severity":"deprecated","affected_versions":">=2.0.0"},{"fix":"Ensure all peer dependencies are installed: npm i --save-dev @babel/core @babel/preset-env @babel/preset-react webpack","message":"The plugin requires @babel/preset-env and @babel/preset-react to be installed. Missing them will cause runtime errors during webpack build.","severity":"breaking","affected_versions":">=2.0.0"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"npm install --save-dev @babel/preset-react","cause":"Missing required peer dependency @babel/preset-react.","error":"Module not found: Error: Can't resolve '@babel/preset-react'"},{"fix":"Ensure your webpack config includes 'plugins: [new JsConfigWebpackPlugin()]' inside module.exports.","cause":"Webpack configuration missing 'plugins' array or plugin not instantiated with 'new'.","error":"TypeError: Cannot read property 'babel' of undefined"},{"fix":"Use const JsConfigWebpackPlugin = require('js-config-webpack-plugin');","cause":"Attempting to use ES module import style with CJS package.","error":"JsConfigWebpackPlugin is not a constructor"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}