-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: utp support bundlers and preprocessors (#2564)
- Loading branch information
1 parent
86612b3
commit 8b13937
Showing
5 changed files
with
16 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
// this file needs to conditionally import a module, ESM doesn't support this synchronously | ||
// we could avoid .cjs by using node:module but that doesn't sit well with preprocessors like typescript | ||
// and bundlers which can bundle for node like webpack | ||
|
||
module.exports = (() => { | ||
try { | ||
return require('utp-native') | ||
} catch (err) { | ||
console.warn('WebTorrent: uTP not supported', err) | ||
return {} | ||
} | ||
})() |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters