Skip to content

fix: Replace webpackIgnore with serverExternalPackages for scheduler imports#459

Merged
rjroy merged 1 commit intomainfrom
fix/systemd-service-post-migration
Feb 6, 2026
Merged

fix: Replace webpackIgnore with serverExternalPackages for scheduler imports#459
rjroy merged 1 commit intomainfrom
fix/systemd-service-post-migration

Conversation

@rjroy
Copy link
Copy Markdown
Owner

@rjroy rjroy commented Feb 6, 2026

Summary

  • Removed webpackIgnore: true from dynamic imports in instrumentation.ts
  • Added serverExternalPackages: ["cron"] to next.config.ts so webpack skips bundling cron (which uses child_process) while still processing the rest of the import chain through extensionAlias
  • Both background schedulers (extraction at 3am, card discovery at 4am) now start cleanly in production

The webpackIgnore hack bypassed webpack entirely for the scheduler imports, which meant the .js.ts extension alias never applied. At runtime, the Next.js server couldn't find logger.js or vault-manager.js because only .ts files exist.

Test plan

  • bun run --cwd nextjs build succeeds
  • systemctl --user restart memory-loop starts cleanly
  • journalctl --user -u memory-loop shows both schedulers started without ERR_MODULE_NOT_FOUND

🤖 Generated with Claude Code

…imports

The instrumentation dynamic imports used webpackIgnore: true to avoid
webpack bundling cron's child_process dependency. This bypassed webpack's
extensionAlias (.js → .ts), so at runtime the Next.js server couldn't
resolve backend module imports. Use serverExternalPackages for cron
instead, letting webpack process the full import chain normally.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@codecov
Copy link
Copy Markdown

codecov Bot commented Feb 6, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@rjroy rjroy merged commit bd304c7 into main Feb 6, 2026
2 checks passed
@rjroy rjroy deleted the fix/systemd-service-post-migration branch February 6, 2026 04:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant