# Chat link missing in post event widget after to Rollup

**URL:** https://meta.discourse.org/t/chat-link-missing-in-post-event-widget-after-to-rollup/400691
**Category:** Bug
**Tags:** events, fixed
**Created:** [April 15, 2026, 1:06pm UTC](https://meta.discourse.org/t/chat-link-missing-in-post-event-widget-after-to-rollup/400691 "2026-04-15T13:06:31Z")
**Posts on this page:** 1
**Showing post:** 1

<div class="post-metadata">

### Author: ![klappradla](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/klappradla/32/531604_2.png) [@klappradla](https://meta.discourse.org/u/klappradla)
#### Post date: [April 15, 2026, 1:06pm UTC](https://meta.discourse.org/t/chat-link-missing-in-post-event-widget-after-to-rollup/400691/1 "2026-04-15T13:06:32Z")

</div>

Hi 👋

we ran into a small bug with the chat feature of the `discourse-calendar` plugin, where the 💬-link to the chat channel was suddenly missing in the post event widget.

It most likely broke with the recent change in Discourse core to move the build system to [Rollup](https://rollupjs.org/):

- [af3385baba](https://github.com/discourse/discourse/commit/af3385baba) — Introduced the Rollup compiler (disabled by default)
- [74d532c559](https://github.com/discourse/discourse/commit/74d532c559) — Enabled the Rollup compiler as default

I can fix it and provide a PR for it 🧑‍💻 .

## Expected behavior

When adding an event to a topic and enabling the `Chat Integration` ("_Create and manage event specific chat channel"_), the event widget on the post would include a 💬-icon with a link to the chat channel associated with the event:

 ![screenshot of post event widget with chat link](https://global.discourse-cdn.com/meta/original/4X/5/7/7/5775a026cad15a72fbc6696210ada1ee57f023a9.png)

## Current behavior

At the moment, on current `main`, this section of the post event widget is just not rendered at all:

 ![screenshot of broken post event widget](https://global.discourse-cdn.com/meta/original/4X/8/4/d/84d47ac5d07cca7e1b5565a9e17a3f52b1ee7a5f.png)

## Fix/Solution

The issue seems to be, that the lazy `optionalRequire` helper does not work as initially intended any more with Rollup. From my understanding, Rollup calls the `optionalRequire` too early, when other modules aren’t yet registered and so it always returns `false`.

What fixes the problem, is to move the `optionalRequire` calls into the component’s constructor, so that it’s actually evaluated lazily.

For the model file, it would for instance look like this:

```diff
diff --git a/plugins/discourse-calendar/assets/javascripts/discourse/models/discourse-post-event-event.js b/plugins/discourse-calendar/assets/javascripts/discourse/models/discourse-post-event-event.js
index 742cc35a84..f687b956aa 100644
--- a/plugins/discourse-calendar/assets/javascripts/discourse/models/discourse-post-event-event.js
+++ b/plugins/discourse-calendar/assets/javascripts/discourse/models/discourse-post-event-event.js
@@ -7,10 +7,6 @@ import User from "discourse/models/user";
 import DiscoursePostEventEventStats from "./discourse-post-event-event-stats";
 import DiscoursePostEventInvitee from "./discourse-post-event-invitee";
 
-const ChatChannel = optionalRequire(
- "discourse/plugins/chat/discourse/models/chat-channel"
-);
-
 const DEFAULT_REMINDER = {
   type: "notification",
   value: 15,
@@ -62,6 +58,8 @@ export default class DiscoursePostEventEvent {
   @tracked _reminders;
 
   constructor(args = {}) {
+ const ChatChannel = optionalRequire( "discourse/plugins/chat/discourse/models/chat-channel");
+
     this.id = args.id;
     this.rrule = args.rrule;
     this.name = args.name;

```

And respectively for the component that renders the actual link:

```diff
diff --git a/plugins/discourse-calendar/assets/javascripts/discourse/components/discourse-post-event/chat-channel.gjs b/plugins/discourse-calendar/assets/javascripts/discourse/components/discourse-post-event/chat-channel.gjs
index f673ee8a9f..a988b341e6 100644
--- a/plugins/discourse-calendar/assets/javascripts/discourse/components/discourse-post-event/chat-channel.gjs
+++ b/plugins/discourse-calendar/assets/javascripts/discourse/components/discourse-post-event/chat-channel.gjs
@@ -1,24 +1,27 @@
+import Component from "@glimmer/component";
 import { LinkTo } from "@ember/routing";
 import { optionalRequire } from "discourse/lib/utilities";
 import { and } from "discourse/truth-helpers";
 
-const ChannelTitle = optionalRequire(
- "discourse/plugins/chat/discourse/components/channel-title"
-);
+export default class DiscoursePostEventChatChannel extends Component {
+ get channelTitle() {
+ return optionalRequire(
+ "discourse/plugins/chat/discourse/components/channel-title"
+ );
+ }
 
-const DiscoursePostEventChatChannel = <template>
- {{#if (and @event.channel ChannelTitle)}}
- <section class="event__section event-chat-channel">
- <span></span>
- <LinkTo
- @route="chat.channel"
- @models={{@event.channel.routeModels}}
- class="chat-channel-link"
- >
- <ChannelTitle @channel={{@event.channel}} />
- </LinkTo>
- </section>
- {{/if}}
-</template>;
-
-export default DiscoursePostEventChatChannel;
+ <template>
+ {{#if (and @event.channel this.channelTitle)}}
+ <section class="event__section event-chat-channel">
+ <span></span>
+ <LinkTo
+ @route="chat.channel"
+ @models={{@event.channel.routeModels}}
+ class="chat-channel-link"
+ >
+ <this.channelTitle @channel={{@event.channel}} />
+ </LinkTo>
+ </section>
+ {{/if}}
+ </template>
+}

```

_(Note: I need to convert it to a class component, that’s why the diff is bigger)_

I will provide a PR with my fix on GitHub, so people can try it out and voice there opinions about it.

---

_[View the full topic](https://meta.discourse.org/t/chat-link-missing-in-post-event-widget-after-to-rollup/400691)._
