Get the current mode (production/development) of a Webpack 4 build. Version 1.1.0 is the latest stable release. This tiny utility checks the `--mode` CLI flag or `NODE_ENV` environment variable and exposes `isProduction`, `isDevelopment`, and a string-comparable object. Works only with Webpack 4 — it will silently return wrong results on Webpack 5. No dependencies, no TypeScript types.
npm install webpack-modeVerified import paths — ran on the pinned version, not inferred.
Checks if Webpack is running in production or development mode using named exports, and shows object string comparison.
Use Webpack's built-in mode detection or upgrade to a Webpack 5-compatible library.
Use template literals (`${mode}`) or the .toString() method, or use the named exports isProduction/isDevelopment.Create a .d.ts file: declare module 'webpack-mode' { export const isProduction: boolean; export const isDevelopment: boolean; const mode: { toString(): string }; export default mode; }Run 'npm install --save-dev webpack-mode' or 'yarn add --dev webpack-mode'.
Use `if (`${webpackMode}` === 'production')` instead of `if (webpackMode === 'production')`.Add a custom type declaration file (.d.ts) as shown in the warnings.
No dependency data recorded yet.