Use webtorrent as external dependency instead of building it with
authorChocobozzz <florian.bigard@gmail.com>
Sat, 4 Jun 2016 11:08:38 +0000 (13:08 +0200)
committerChocobozzz <florian.bigard@gmail.com>
Sat, 4 Jun 2016 11:08:38 +0000 (13:08 +0200)
webpack

client/config/webpack.common.js
client/config/webpack.dev.js
client/config/webpack.prod.js
client/src/index.html
client/src/vendor.ts

index 653866b939a62b89f8a2d260645bfc178213cab4..7f1da74b9afbecaaa7d2267878af04a5d27e6e10 100644 (file)
@@ -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'
     })
 
   ],
index 8c6d1aac7df06869d2818d7043b16a47cfecd536..50193bf58f18c7f2e61e4eb48c271083853c5f27 100644 (file)
@@ -85,6 +85,10 @@ module.exports = webpackMerge(commonConfig, {
 
   },
 
+  externals: {
+    webtorrent: 'WebTorrent'
+  },
+
   plugins: [
 
     /**
index 8827888a3b986464904ee660b4231df0d4e62598..7ce5727d32bbfed1d6c7bad41c71c5035d39fb9e 100644 (file)
@@ -83,6 +83,10 @@ module.exports = webpackMerge(commonConfig, {
 
   },
 
+  externals: {
+    webtorrent: 'WebTorrent'
+  },
+
   /**
    * Add additional plugins to the compiler.
    *
index 83f4cc8f09d26700bf7efcb19cabb1e9996b850a..c45ab6b6f0cc94df5145d4642e11eee17d5a884f 100644 (file)
@@ -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 -->
index dcc4439db03461c7f246ed58c9254a8907534e6b..6d7ebc3b428f5bc03936272ee6ea64dd24e337e7 100644 (file)
@@ -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';