Skip to content

Commit

Permalink
bigbrain webpack-only moves in the chat ♟️
Browse files Browse the repository at this point in the history
  • Loading branch information
Shaptic committed Nov 15, 2023
1 parent a663580 commit 65442da
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
5 changes: 1 addition & 4 deletions config/webpack.config.browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,17 +65,14 @@ const config = {
}),
// Ignore native modules (sodium-native) and opt-in polyfills
new webpack.IgnorePlugin({ resourceRegExp: /(sodium-native|eventsource)/ }),
new webpack.IgnorePlugin({ resourceRegExp: /eventsource/ }),
new NodePolyfillPlugin({
includeAliases: ['http', 'https'] // others aren't needed
}),
new webpack.ProvidePlugin({
Buffer: ['buffer', 'Buffer']
}),
],
externals: {
"eventsource": "require('eventsource')"
}
externals: "eventsource",
};

module.exports = config;
3 changes: 2 additions & 1 deletion src/horizon/call_builder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ let EventSource: Constructable<EventSource>;
try {
EventSource = anyGlobal.EventSource ??
anyGlobal.window?.EventSource ??
require("eventsource");
// @ts-ignore
(__non_webpack_require__ ?? require)("eventsource");
} catch (e: any) {
console.warn(
'⚠️ No EventSource provider found: either polyfill it ' +
Expand Down

0 comments on commit 65442da

Please sign in to comment.