All notable changes to this project will be documented in this file.
The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.
- Restored popup/UI page log forwarding: Popup, options, devtools, and other UI page logs are now correctly forwarded to the dev server. The v1.3.5 release incorrectly skipped UI pages which broke the core functionality of the module.
- Removed UI page skipping: The
shouldSkipConsoleForward()check was removed from the transform hook. The original React "Invalid hook call" errors were caused by missingresolve.dedupeconfiguration in Vite, not by the console-forward module. Users experiencing React duplicate instance errors should add the following to theirwxt.config.ts:vite: () => ({ resolve: { dedupe: ["react", "react-dom", "react/jsx-runtime", "react/jsx-dev-runtime"], }, })
- Only inject into actual WXT entry files: Console forwarding now only injects into actual entry files (
background.ts,popup/main.tsx,content/index.ts), not shared modules (shared/utils.ts,popup/App.tsx). This fixes React duplicate instance errors caused by injecting into shared code imported by both UI pages and non-UI entries.
isWxtEntryFile()function: New exported function to detect actual WXT entry files- Shared code directory exclusion: Directories named
shared,common,lib,utils,helpers,hooks,components,stores,services,api,types,constantsare excluded from injection even if they containindex.tsormain.ts
- Incomplete release: This version was published without all fixes. Use 1.3.5 instead.
- Vite dev server URL path handling: Fixed UI page detection not working during
wxt devbecause Vite passes URL-style paths (/entrypoints/popup/main.tsx) instead of full file system paths. This was causing React duplicate instance errors in popup/options/devtools pages.
- JS/TS entrypoint classification: Single-file entrypoints like
popup.tsare now correctly treated as unlisted-script (not skipped), while only directory-based UI entrypoints likepopup/main.tsxare skipped - Configurable entrypointsDir: Now uses
wxt.config.entrypointsDirinstead of hardcoded/entrypoints/path - Windows path support: Normalize backslashes in path handling
- CSS extension handling: Added support for
.sass,.styl,.stylusextensions
- Renamed Playwright tests to
.pw.tsto avoid conflicts with Bun test runner
- React iframe context compatibility: Fixed "Invalid hook call" errors in browser extension iframe contexts (devtools panels, popups, options pages)
- Transform hook now skips injection for entry point files (
main,index,App) in theentrypoints/directory to prevent React module resolution issues - Uses exact basename matching instead of substring matching to avoid false positives (e.g.,
domain.tscontaining "main") - Each iframe window patches its own console independently, ensuring logs forward correctly from all contexts
- Transform hook now skips injection for entry point files (
- React devtools panel example: Added example devtools panel with React hooks to verify iframe compatibility
- Regression test: Added Playwright test to catch React hook errors in iframe contexts
- ANSI color conversion: Browser console
%cformat specifiers with CSS colors are now converted to ANSI terminal colors - Format specifier parsing: Supports
%c(CSS styles),%s(substitutions), and%%(literal percent) - CSS color support: Handles hex (
#RGB,#RRGGBB),rgb(), named colors, and reset keywords (inherit,initial,unset,revert) - Bun.color integration: Uses
Bun.color()for robust CSS-to-ANSI conversion with fallback for non-Bun environments - Unit tests: Comprehensive test suite for format specifier parsing and color conversion
- Color leaking prevention: Each
%cresets to default if no usable color is provided, matching browser behavior - TTY-independent output: Uses
ansi-16mformat for consistent colored output regardless of terminal detection
- Debug module integration: Example extension now demonstrates using the
debugmodule with console forwarding - Headless extension testing: Playwright tests now support headless mode using Chrome's
--headless=newflag - HEADED environment variable: Run tests with visible browser using
HEADED=1 bun run test
- Sourcemap generation: Transform hook now generates proper sourcemaps using
magic-string, fixing Vite's "sourcemap is likely to be incorrect" warning - MV3 CSP compliance: Removed HTML inline script injection to avoid Content Security Policy violations in Chrome MV3 extension pages
- External scripts for CSP: Use external virtual modules instead of inline scripts for HTML entrypoints
- Playwright tests updated for MV3: Tests now use
context.serviceWorkers()instead of deprecatedbackgroundPages()for Manifest V3 extensions - Improved test locators: Tests use resilient
getByRole()andgetByText()locators per Playwright best practices - README corrections: Fixed module usage example (string name instead of import), updated Vite version requirements
- Added
magic-string^0.30.21 for sourcemap generation
- WXT dev server port configuration support: Module now properly respects the
dev.server.portsetting fromwxt.config.tsinstead of defaulting to port 3000 - Improved logging: Added clear logging messages showing which dev server URL is being used
- Simplified port detection: Removed complex port detection logic that parsed command line arguments in favor of using WXT's resolved configuration directly
- Better error handling: Added assertion to ensure dev server configuration is available during module setup
- Port configuration bug: Fixed issue where the module would always use port 3000 regardless of the configured port in
wxt.config.ts - TypeScript type errors: Fixed various TypeScript issues in server.listen call
- Duplicate console forwarding: Implemented singleton pattern to prevent duplicate initialization
- Specifier error: Resolved 'specifier.indexOf is not a function' error in module resolution
- Removed unused imports and variables
- Simplified Vite plugin by removing unnecessary server configuration hooks
- Better code organization and cleaner implementation
- Initial release of WXT Console Forward Module
- Support for forwarding console logs from all web extension contexts (background, content, popup, inpage)
- Automatic injection of console forwarding code
- Context identification and labeling
- Object and array serialization
- Stack trace forwarding
- Error and promise rejection handling
- Configurable logging levels and endpoints
- Development mode only operation for security
- Comprehensive example extension
- Virtual module system integration with Vite
- Log buffering for performance
- CORS support for cross-origin requests
- Singleton pattern to prevent duplicate initialization
- Support for excluding specific entrypoints
- Silent error mode option