{"id":28458,"library":"webpack-post-compile-plugin","title":"webpack-post-compile-plugin","description":"A webpack plugin that post-compiles specified node_modules packages (e.g., those listed in `compileDependencies` or marked with `postCompile`) using the same loaders as your application source, enabling trasformation of dependencies like Babel or TypeScript. Version 1.2.3 is current; active development with infrequent releases. Compared to alternatives like `webpack-loader`, it uses `package.json` config to declare which packages need post-compilation, supporting micromatch patterns (>=1.0.0) and multiple configuration methods. Requires Webpack >=3.","status":"active","version":"1.2.3","language":"javascript","source_language":"en","source_url":"https://github.com/dolymood/webpack-post-compile-plugin","tags":["javascript","post-complile","post","compile","webpack","webpack plugin","plugin"],"install":[{"cmd":"npm install webpack-post-compile-plugin","lang":"bash","label":"npm"},{"cmd":"yarn add webpack-post-compile-plugin","lang":"bash","label":"yarn"},{"cmd":"pnpm add webpack-post-compile-plugin","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"peer dependency, must be >=3","package":"webpack","optional":false}],"imports":[{"note":"Package does not provide ES module exports; use CommonJS require.","wrong":"import PostCompilePlugin from 'webpack-post-compile-plugin'","symbol":"PostCompilePlugin","correct":"const PostCompilePlugin = require('webpack-post-compile-plugin')"},{"note":"No default export; the main export is the constructor directly.","wrong":"","symbol":"PostCompilePlugin","correct":"const PostCompilePlugin = require('webpack-post-compile-plugin').default"},{"note":"Must be instantiated with `new`; passing options is optional.","wrong":"PostCompilePlugin()","symbol":"PostCompilePlugin","correct":"new PostCompilePlugin({ /* options */ })"}],"quickstart":{"code":"// webpack.config.js\nconst PostCompilePlugin = require('webpack-post-compile-plugin');\nconst path = require('path');\n\nmodule.exports = {\n  entry: './src/index.js',\n  output: {\n    path: path.resolve(__dirname, 'dist'),\n    filename: 'bundle.js'\n  },\n  module: {\n    rules: [\n      {\n        test: /\\.js$/,\n        exclude: /node_modules\\/(?!your-pkg)/,\n        use: {\n          loader: 'babel-loader'\n        }\n      }\n    ]\n  },\n  plugins: [\n    new PostCompilePlugin({\n      compileDependencies: ['your-pkg']\n    })\n  ]\n};\n// In package.json of your-pkg: { \"postCompile\": true }","lang":"javascript","description":"Shows minimal configuration with webpack to post-compile a specific node module using babel-loader."},"warnings":[{"fix":"Update config to use micromatch patterns if needed, or keep boolean `true`.","message":"Version 1.0.0 changed `postCompile` option from boolean to string/array patterns using micromatch. Existing configs using `true` still work but pattern matching behavior may differ.","severity":"breaking","affected_versions":">=1.0.0 <1.0.0"},{"fix":"Use `compileDependencies` or `compilePaths` options.","message":"Options `dependencies` and `dependenciesKey` may be deprecated in future versions; prefer `compileDependencies`.","severity":"deprecated","affected_versions":">=0.5.0"},{"fix":"Use a positive `include` pattern in the loader rule that matches the packages you want to compile (e.g., include the app directory and then exclude only non-post-compile node_modules).","message":"The plugin does not automatically exclude node_modules from loaders; you must configure the loader rule to include the post-compiled packages.","severity":"gotcha","affected_versions":">=0.1.0"},{"fix":"List all transitive dependencies that need post-compilation in `compileDependencies` or ensure they have `postCompile` in their package.json.","message":"The plugin only processes packages that are direct dependencies of your app, not transitive dependencies, unless they also have `postCompile` or are listed in `compileDependencies`.","severity":"gotcha","affected_versions":">=0.1.0"}],"env_vars":null,"last_verified":"2026-05-09T00:00:00.000Z","next_check":"2026-08-07T00:00:00.000Z","problems":[{"fix":"Run `npm install micromatch@^4.0.0` or reinstall the package.","cause":"Micromatch is a dependency of the plugin but may not be installed if npm deduplicates or if the package is missing.","error":"Error: Cannot find module 'micromatch'"},{"fix":"Adjust the loader rule to include the package: `include: [path.resolve(__dirname, 'node_modules/some-module')]`.","cause":"Loader is not processing the node_modules package because the loader rule excludes node_modules.","error":"Module not found: Error: Can't resolve 'some-module'"},{"fix":"Use `new PostCompilePlugin()`.","cause":"Using `PostCompilePlugin()` without `new` or importing incorrectly.","error":"TypeError: PostCompilePlugin is not a constructor"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}