{"id":20795,"library":"webpack-mild-compile","title":"webpack-mild-compile","description":"A workaround to prevent webpack from endlessly recompiling when files are created or modified during watch mode, particularly useful in combination with plugins that dynamically generate files (e.g., webpack-iconfont, webpack-spritesmith). Version 3.4.0 supports webpack 2/3/4/5. The package provides both a webpack plugin and a Node API to decouple file events and avoid repeated compilation cycles. It is a lightweight, focused solution for a common footgun in webpack development workflows.","status":"active","version":"3.4.0","language":"javascript","source_language":"en","source_url":"https://github.com/yessky/webpack-mild-compile","tags":["javascript","webpack","endless","compile"],"install":[{"cmd":"npm install webpack-mild-compile","lang":"bash","label":"npm"},{"cmd":"yarn add webpack-mild-compile","lang":"bash","label":"yarn"},{"cmd":"pnpm add webpack-mild-compile","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"Plugin is exported as a named export. Directly calling the module as a function without .Plugin is incorrect for the plugin usage.","wrong":"const WebpackMildCompile = require('webpack-mild-compile'); new WebpackMildCompile();","symbol":"Plugin","correct":"const { Plugin } = require('webpack-mild-compile');"},{"note":"The module exports a function directly for Node API usage. There is no .default export.","wrong":"const mildCompile = require('webpack-mild-compile').default;","symbol":"default","correct":"const mildCompile = require('webpack-mild-compile'); mildCompile(compiler);"},{"note":"ESM import works as expected. The package provides TypeScript types.","wrong":null,"symbol":"Plugin","correct":"import { Plugin } from 'webpack-mild-compile';"}],"quickstart":{"code":"// Webpack plugin usage (prevent endless recompilation)\nconst { Plugin } = require('webpack-mild-compile');\n\n// webpack.config.js\nmodule.exports = {\n  // ... other config\n  plugins: [\n    new Plugin()\n  ]\n};\n\n// Or Node API usage (with webpack and koa-webpack)\nconst webpack = require('webpack');\nconst config = require('./webpack.config.js');\nconst compiler = webpack(config);\nrequire('webpack-mild-compile')(compiler);\n\nconst app = new (require('koa'))();\nconst koaWebpack = require('koa-webpack');\napp.use(koaWebpack({ compiler }));","lang":"javascript","description":"Shows how to use webpack-mild-compile as a webpack plugin or via Node API to avoid endless recompilation during watch mode."},"warnings":[{"fix":"Use `new (require('webpack-mild-compile').Plugin)()` or import the named export.","message":"Plugin must be instantiated with `new Plugin()` — calling the module as a function for plugin usage does nothing.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"","message":"No known deprecations in current version.","severity":"deprecated","affected_versions":""},{"fix":"","message":"No known breaking changes between versions.","severity":"breaking","affected_versions":""}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"Use the named export `Plugin` instead: `new (require('webpack-mild-compile').Plugin)()`.","cause":"Trying to use the default export as a constructor for the plugin (e.g., `new require('webpack-mild-compile')()`).","error":"TypeError: webpackMildCompile is not a constructor"},{"fix":"Run `npm install --save-dev webpack-mild-compile`.","cause":"Package not installed or not in node_modules.","error":"Cannot find module 'webpack-mild-compile'"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}