Registry / devops / webpack-post-compile-plugin

webpack-post-compile-plugin

JSON →
library1.2.3jsnpmunverified

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.

npm install webpack-post-compile-plugin
INSTALL
IMPORT
SIG · WEBPACK-POST-COMPI
W
webpack-post-compile-plugin
devopsjavascriptv1.2.3
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

PostCompilePlugin
const PostCompilePlugin = require('webpack-post-compile-plugin')
import PostCompilePlugin from 'webpack-post-compile-plugin'
Package does not provide ES module exports; use CommonJS require.
PostCompilePlugin
const PostCompilePlugin = require('webpack-post-compile-plugin').default
No default export; the main export is the constructor directly.
PostCompilePlugin
new PostCompilePlugin({ /* options */ })
PostCompilePlugin()
Must be instantiated with `new`; passing options is optional.

Shows minimal configuration with webpack to post-compile a specific node module using babel-loader.

// webpack.config.js const PostCompilePlugin = require('webpack-post-compile-plugin'); const path = require('path'); module.exports = { entry: './src/index.js', output: { path: path.resolve(__dirname, 'dist'), filename: 'bundle.js' }, module: { rules: [ { test: /\.js$/, exclude: /node_modules\/(?!your-pkg)/, use: { loader: 'babel-loader' } } ] }, plugins: [ new PostCompilePlugin({ compileDependencies: ['your-pkg'] }) ] }; // In package.json of your-pkg: { "postCompile": true }
Debug
Known issues
breakingVersion 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.
fix
Update config to use micromatch patterns if needed, or keep boolean `true`.
affects: >=1.0.0 <1.0.0
deprecatedOptions `dependencies` and `dependenciesKey` may be deprecated in future versions; prefer `compileDependencies`.
fix
Use `compileDependencies` or `compilePaths` options.
affects: >=0.5.0
gotchaThe plugin does not automatically exclude node_modules from loaders; you must configure the loader rule to include the post-compiled packages.
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).
affects: >=0.1.0
gotchaThe plugin only processes packages that are direct dependencies of your app, not transitive dependencies, unless they also have `postCompile` or are listed in `compileDependencies`.
fix
List all transitive dependencies that need post-compilation in `compileDependencies` or ensure they have `postCompile` in their package.json.
affects: >=0.1.0
Errors
Common errors & fixes
Error: Cannot find module 'micromatch'
Micromatch is a dependency of the plugin but may not be installed if npm deduplicates or if the package is missing.
fix
Run `npm install micromatch@^4.0.0` or reinstall the package.
Module not found: Error: Can't resolve 'some-module'
Loader is not processing the node_modules package because the loader rule excludes node_modules.
fix
Adjust the loader rule to include the package: `include: [path.resolve(__dirname, 'node_modules/some-module')]`.
TypeError: PostCompilePlugin is not a constructor
Using `PostCompilePlugin()` without `new` or importing incorrectly.
fix
Use `new PostCompilePlugin()`.
Upgrade
Version history
1.2.3latest on npm
Audit
Dependencies
webpackrequiredpeer dependency, must be >=3
Agent activity
21 hits · last 30 days
node
18
OpenAI (training)
1
Resources
webpack-post-compile-plugin — npm install webpack-post-compile-plugin · libregistry