diff --git a/client/config/webpack.common.js b/client/config/webpack.common.js index 653866b93..7f1da74b9 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 8c6d1aac7..50193bf58 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 8827888a3..7ce5727d3 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 83f4cc8f0..c45ab6b6f 100644 --- a/client/src/index.html +++ b/client/src/index.html @@ -8,6 +8,9 @@ + + + diff --git a/client/src/vendor.ts b/client/src/vendor.ts index dcc4439db..6d7ebc3b4 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';