time-fix-plugin
raw JSON → 2.0.7 verified Sat Apr 25 auth: no javascript maintenance
Webpack plugin (v2.0.7, latest) that fixes the startTime for webpack watcher, addressing a watchpack issue where startTime is incorrectly set to 0, causing unnecessary recompilations. Maintained by egoist, supports webpack >=4.0.0. Differentiator: simple drop-in solution; for webpack <4, use v1. No active development since 2020.
Common errors
error TypeError: TimeFixPlugin is not a constructor ↓
cause Using const { TimeFixPlugin } = require('time-fix-plugin') – named import instead of default.
fix
Use const TimeFixPlugin = require('time-fix-plugin')
error Error: Cannot find module 'time-fix-plugin' ↓
cause Package not installed or wrong version.
fix
Run npm install time-fix-plugin or check node_modules.
error Unhandled rejection: TypeError: Cannot read property 'startTime' of undefined ↓
cause Using plugin with webpack <4 (startTime not present).
fix
Upgrade to webpack >=4 or use time-fix-plugin@1.
Warnings
breaking Version 2 requires webpack >=4.0.0. Using with webpack <4 will cause errors or unexpected behavior. ↓
fix Use version 1 (time-fix-plugin@1) for webpack <4.
deprecated No new releases since 2020; project is in maintenance mode. Consider alternatives if issues arise. ↓
fix Monitor the GitHub repo for forks or alternatives.
gotcha Webpack v5 may have fixed the underlying watchpack issue; test if plugin is still needed. ↓
fix Try removing the plugin and see if watcher behaves correctly.
Install
npm install time-fix-plugin yarn add time-fix-plugin pnpm add time-fix-plugin Imports
- TimeFixPlugin wrong
import TimeFixPlugin from 'time-fix-plugin'correctconst TimeFixPlugin = require('time-fix-plugin') - TimeFixPlugin (default export) wrong
import { TimeFixPlugin } from 'time-fix-plugin'correctconst TimeFixPlugin = require('time-fix-plugin') - Webpack config usage wrong
plugins: [new TimeFixPlugin]correctplugins: [new TimeFixPlugin()]
Quickstart
// webpack.config.js
const TimeFixPlugin = require('time-fix-plugin');
module.exports = {
// ... other config
plugins: [
new TimeFixPlugin()
]
};