]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/commitdiff
Bundle webtorrent with webpack. Closes https://github.com/Chocobozzz/PeerTube/issues/50
authorChocobozzz <florian.bigard@gmail.com>
Sun, 11 Jun 2017 13:25:36 +0000 (15:25 +0200)
committerChocobozzz <florian.bigard@gmail.com>
Sun, 11 Jun 2017 13:58:27 +0000 (15:58 +0200)
client/config/webpack.common.js
client/config/webpack.dev.js
client/config/webpack.prod.js
client/src/app/videos/video-watch/video-watch.component.ts
client/src/app/videos/video-watch/webtorrent.service.ts
client/src/index.html

index 4599858803d9e69930eb8148ad874d8396d52f21..a81bca9d2854b70bcc98389c147268ebd0be5d55 100644 (file)
@@ -260,10 +260,6 @@ module.exports = function (options) {
           from: 'src/assets',
           to: 'assets'
         },
-        {
-          from: 'node_modules/webtorrent/webtorrent.min.js',
-          to: 'assets/webtorrent'
-        },
         {
           from: 'src/standalone',
           to: 'standalone'
index d6ebed730070f8c653bebbb809100971b6b6d050..42d9ca37ea9f2d1253a9e01ca282917a839ce065 100644 (file)
@@ -83,10 +83,6 @@ module.exports = function (env) {
       libraryTarget: 'var'
     },
 
-    externals: {
-      webtorrent: 'WebTorrent'
-    },
-
     module: {
 
       // Too slow, life is short
@@ -246,6 +242,7 @@ module.exports = function (env) {
     node: {
       global: true,
       crypto: 'empty',
+      fs: 'empty',
       process: true,
       module: false,
       clearImmediate: false,
index 3f063c7c68da79d82e8d12df92c7d8ced68ced3a..c27a4f4b03e46599a4526a49d4659d3d8ff0cf93 100644 (file)
@@ -81,10 +81,6 @@ module.exports = function (env) {
       publicPath: '/client/'
     },
 
-    externals: {
-      webtorrent: 'WebTorrent'
-    },
-
     /**
      * Add additional plugins to the compiler.
      *
@@ -272,6 +268,7 @@ module.exports = function (env) {
     node: {
       global: true,
       crypto: 'empty',
+      fs: 'empty',
       process: false,
       module: false,
       clearImmediate: false,
index 32c84778523edcbb1150a17fce4af67b30dd147e..bcfebf2fd12549468b5782960eb5c902de5efa88 100644 (file)
@@ -21,15 +21,15 @@ import { WebTorrentService } from './webtorrent.service';
 })
 
 export class VideoWatchComponent implements OnInit, OnDestroy {
-  private static LOADTIME_TOO_LONG: number = 20000;
+  private static LOADTIME_TOO_LONG = 20000;
 
   @ViewChild('videoMagnetModal') videoMagnetModal: VideoMagnetComponent;
   @ViewChild('videoShareModal') videoShareModal: VideoShareComponent;
   @ViewChild('videoReportModal') videoReportModal: VideoReportComponent;
 
   downloadSpeed: number;
-  error: boolean = false;
-  loading: boolean = false;
+  error = false;
+  loading = false;
   numPeers: number;
   player: videojs.Player;
   playerElement: Element;
index 630a5c46983167811426081a145a56d3cc41ddba..8936e79925f4daa5f02c7c2fc6dfb1e512eb7472 100644 (file)
@@ -1,7 +1,7 @@
 import { Injectable } from '@angular/core';
 import { Subject } from 'rxjs/Subject';
 
-declare const WebTorrent;
+import * as WebTorrent from 'webtorrent';
 
 @Injectable()
 export class WebTorrentService {
index ea88bb15b68b64ae233b61507fea7c68f124d8b3..4346775b1a0c097f7423a9af30b0d0066e2732e6 100644 (file)
@@ -11,9 +11,6 @@
     <!-- opengraph tags -->
     <!-- Do not remove it! -->
 
-    <!-- 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> -->
-
     <link rel="icon" type="image/png" href="/client/assets/favicon.png" />
 
     <!-- base url -->