{"id":19151,"library":"babel-plugin-remove-webpack","title":"babel-plugin-remove-webpack","description":"Babel plugin that removes webpack-specific functions (require.ensure, require.include) from JavaScript code, useful for running universal JavaScript on the server without shims. Version 1.1.0 is the latest and only stable release, with low maintenance cadence (last update years ago). Unlike manual polyfills, this plugin automatically strips webpack code at the AST level, enabling server-side execution without code splitting. For Node.js environments with babel-register, it avoids defining dummy functions per file. Not for use in webpack builds, as it would disable code splitting.","status":"maintenance","version":"1.1.0","language":"javascript","source_language":"en","source_url":"https://github.com/knpwrs/babel-plugin-remove-webpack","tags":["javascript","babel-plugin","remove","webpack"],"install":[{"cmd":"npm install babel-plugin-remove-webpack","lang":"bash","label":"npm"},{"cmd":"yarn add babel-plugin-remove-webpack","lang":"bash","label":"yarn"},{"cmd":"pnpm add babel-plugin-remove-webpack","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"peer dependency for Babel plugin compatibility","package":"@babel/core","optional":true}],"imports":[{"note":"CJS only; no default export for ESM. Use require() for Babel config.","wrong":"import plugin from 'babel-plugin-remove-webpack'","symbol":"default","correct":"module.exports = require('babel-plugin-remove-webpack')"}],"quickstart":{"code":"// Install: npm install --save-dev babel-plugin-remove-webpack\n// In .babelrc or babel.config.js:\n{\n  \"plugins\": [\"remove-webpack\"]\n}\n\n// With babel-register in your server entry:\nrequire('@babel/register')({ plugins: ['remove-webpack'] });\nrequire('./client-code'); // will run without require.ensure/require.include\n\n// Or programmatically:\nconst babel = require('@babel/core');\nconst result = babel.transform(\n  `require.ensure(['a'], function(r) { r('a'); });`,\n  { plugins: ['remove-webpack'] }\n);\nconsole.log(result.code); // (function () { require('a'); })();","lang":"javascript","description":"Demonstrates how to install, configure, and use the plugin with babel-register or programmatically."},"warnings":[{"fix":"Only apply in server-side Babel transforms, not in webpack configuration.","message":"Do not use this plugin in webpack builds; it will remove code splitting.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Use dynamic import() on modern webpack and consider a different plugin for that case.","message":"require.ensure is deprecated in webpack in favor of dynamic import(). This plugin does not handle dynamic imports.","severity":"deprecated","affected_versions":">=1.0.0"},{"fix":"Use require() in Babel config or transform.","message":"Plugin is CJS-only; no ESM export. Cannot import via import statement.","severity":"gotcha","affected_versions":">=1.0.0"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"Run 'npm install babel-plugin-remove-webpack --save-dev' and ensure node_modules is accessible.","cause":"Missing npm install or wrong working directory.","error":"Cannot find module 'babel-plugin-remove-webpack'"},{"fix":"Check Babel config includes 'remove-webpack' in plugins, and that the transform runs before execution.","cause":"Plugin not applied or not working; require.ensure remains in code.","error":"TypeError: Cannot read property 'ensure' of undefined"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}