Skip to content

ActivityPub-federated video streaming platform using P2P directly in your web browser

Use webtorrent as external dependency instead of building it with webpack

Chocobozzz7f82b8ae3772
diff --git a/client/config/webpack.common.js b/client/config/webpack.common.js
index 653866b939..7f1da74b9a 100644
--- a/client/config/webpack.common.js
+++ b/client/config/webpack.common.js
@@ -222,10 +222,16 @@ module.exports = {
*
* See: https://www.npmjs.com/package/copy-webpack-plugin
*/
- new CopyWebpackPlugin([{
- from: 'src/assets',
- to: 'assets'
- }]),
+ new CopyWebpackPlugin([
+ {
+ from: 'src/assets',
+ to: 'assets'
+ },
+ {
+ from: 'node_modules/webtorrent/webtorrent.min.js',
+ to: 'assets/webtorrent'
+ }
+ ]),
/*
* Plugin: HtmlWebpackPlugin
@@ -243,8 +249,7 @@ module.exports = {
new webpack.ProvidePlugin({
jQuery: 'jquery',
$: 'jquery',
- jquery: 'jquery',
- WebTorrent: 'webtorrent/webtorrent.min'
+ jquery: 'jquery'
})
],
diff --git a/client/config/webpack.dev.js b/client/config/webpack.dev.js
index 8c6d1aac7d..50193bf58f 100644
--- a/client/config/webpack.dev.js
+++ b/client/config/webpack.dev.js
@@ -85,6 +85,10 @@ module.exports = webpackMerge(commonConfig, {
},
+ externals: {
+ webtorrent: 'WebTorrent'
+ },
+
plugins: [
/**
diff --git a/client/config/webpack.prod.js b/client/config/webpack.prod.js
index 8827888a3b..7ce5727d32 100644
--- a/client/config/webpack.prod.js
+++ b/client/config/webpack.prod.js
@@ -83,6 +83,10 @@ module.exports = webpackMerge(commonConfig, {
},
+ externals: {
+ webtorrent: 'WebTorrent'
+ },
+
/**
* Add additional plugins to the compiler.
*
diff --git a/client/src/index.html b/client/src/index.html
index 83f4cc8f09..c45ab6b6f0 100644
--- a/client/src/index.html
+++ b/client/src/index.html
@@ -8,6 +8,9 @@
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="icon" href="/client/assets/favicon.ico" />
+
+ <!-- TODO: bundle it with webpack when https://github.com/webpack/webpack/pull/1931 will be merged -->
+ <script src="/client/assets/webtorrent/webtorrent.min.js"></script>
</head>
<!-- 3. Display the application -->
diff --git a/client/src/vendor.ts b/client/src/vendor.ts
index dcc4439db0..6d7ebc3b42 100644
--- a/client/src/vendor.ts
+++ b/client/src/vendor.ts
@@ -19,5 +19,3 @@ import 'jquery';
import 'bootstrap-loader';
import 'jquery.ui.widget/jquery.ui.widget';
import 'blueimp-file-upload';
-// TODO: build webtorrent with webpack when https://github.com/webpack/webpack/pull/1931 will be merged
-import 'webtorrent/webtorrent.min';