aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/webpack
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2021-05-14 16:56:44 +0200
committerChocobozzz <chocobozzz@cpy.re>2021-05-27 16:00:13 +0200
commit662351e62669d11f5dfb7c871edf37095ec0097e (patch)
treebd8fa17b4435cd6ae06a561b34b214d95e91ac08 /client/webpack
parent9aff616d5051a93f69a96fd567f0563982019d15 (diff)
downloadPeerTube-662351e62669d11f5dfb7c871edf37095ec0097e.tar.gz
PeerTube-662351e62669d11f5dfb7c871edf37095ec0097e.tar.zst
PeerTube-662351e62669d11f5dfb7c871edf37095ec0097e.zip
Update embed webpack config
Diffstat (limited to 'client/webpack')
-rw-r--r--client/webpack/webpack.video-embed.js33
1 files changed, 21 insertions, 12 deletions
diff --git a/client/webpack/webpack.video-embed.js b/client/webpack/webpack.video-embed.js
index 7de63adfc..68749a02a 100644
--- a/client/webpack/webpack.video-embed.js
+++ b/client/webpack/webpack.video-embed.js
@@ -4,6 +4,7 @@ const path = require('path')
4const HtmlWebpackPlugin = require('html-webpack-plugin') 4const HtmlWebpackPlugin = require('html-webpack-plugin')
5const TerserPlugin = require('terser-webpack-plugin') 5const TerserPlugin = require('terser-webpack-plugin')
6const LoaderOptionsPlugin = require('webpack/lib/LoaderOptionsPlugin') 6const LoaderOptionsPlugin = require('webpack/lib/LoaderOptionsPlugin')
7const ProvidePlugin = require('webpack/lib/ProvidePlugin')
7const MiniCssExtractPlugin = require('mini-css-extract-plugin') 8const MiniCssExtractPlugin = require('mini-css-extract-plugin')
8 9
9module.exports = function () { 10module.exports = function () {
@@ -29,6 +30,15 @@ module.exports = function () {
29 '@root-helpers': path.resolve('src/root-helpers'), 30 '@root-helpers': path.resolve('src/root-helpers'),
30 '@shared/models': path.resolve('../shared/models'), 31 '@shared/models': path.resolve('../shared/models'),
31 '@shared/core-utils': path.resolve('../shared/core-utils') 32 '@shared/core-utils': path.resolve('../shared/core-utils')
33 },
34
35 fallback: {
36 fs: [ path.resolve('src/shims/noop.ts') ],
37 http: [ path.resolve('src/shims/http.ts') ],
38 https: [ path.resolve('src/shims/https.ts') ],
39 path: [ path.resolve('src/shims/path.ts') ],
40 stream: [ path.resolve('src/shims/noop.ts') ],
41 crypto: [ path.resolve('src/shims/noop.ts') ]
32 } 42 }
33 }, 43 },
34 44
@@ -37,13 +47,13 @@ module.exports = function () {
37 47
38 filename: process.env.ANALYZE_BUNDLE === 'true' 48 filename: process.env.ANALYZE_BUNDLE === 'true'
39 ? '[name].bundle.js' 49 ? '[name].bundle.js'
40 : '[name].[hash].bundle.js', 50 : '[name].[contenthash].bundle.js',
41 51
42 sourceMapFilename: '[file].map', 52 sourceMapFilename: '[file].map',
43 53
44 chunkFilename: process.env.ANALYZE_BUNDLE === 'true' 54 chunkFilename: process.env.ANALYZE_BUNDLE === 'true'
45 ? '[name].chunk.js' 55 ? '[name].chunk.js'
46 : '[id].[hash].chunk.js', 56 : '[id].[contenthash].chunk.js',
47 57
48 publicPath: '/client/standalone/videos/' 58 publicPath: '/client/standalone/videos/'
49 }, 59 },
@@ -114,10 +124,15 @@ module.exports = function () {
114 }, 124 },
115 125
116 plugins: [ 126 plugins: [
127 new ProvidePlugin({
128 process: 'process/browser',
129 Buffer: [ 'buffer', 'Buffer' ]
130 }),
131
117 new MiniCssExtractPlugin({ 132 new MiniCssExtractPlugin({
118 filename: process.env.ANALYZE_BUNDLE === 'true' 133 filename: process.env.ANALYZE_BUNDLE === 'true'
119 ? '[name].css' 134 ? '[name].css'
120 : '[name].[hash].css' 135 : '[name].[contenthash].css'
121 }), 136 }),
122 137
123 new HtmlWebpackPlugin({ 138 new HtmlWebpackPlugin({
@@ -126,7 +141,7 @@ module.exports = function () {
126 title: 'PeerTube', 141 title: 'PeerTube',
127 chunksSortMode: 'auto', 142 chunksSortMode: 'auto',
128 inject: 'body', 143 inject: 'body',
129 chunks: ['video-embed'], 144 chunks: [ 'video-embed' ],
130 minify: { 145 minify: {
131 collapseWhitespace: true, 146 collapseWhitespace: true,
132 removeComments: false, 147 removeComments: false,
@@ -143,7 +158,7 @@ module.exports = function () {
143 title: 'PeerTube', 158 title: 'PeerTube',
144 chunksSortMode: 'auto', 159 chunksSortMode: 'auto',
145 inject: 'body', 160 inject: 'body',
146 chunks: ['test-embed'] 161 chunks: [ 'test-embed' ]
147 }), 162 }),
148 163
149 /** 164 /**
@@ -188,13 +203,7 @@ module.exports = function () {
188 }, 203 },
189 204
190 node: { 205 node: {
191 global: true, 206 global: true
192 crypto: 'empty',
193 fs: 'empty',
194 process: true,
195 module: false,
196 clearImmediate: false,
197 setImmediate: false
198 } 207 }
199 } 208 }
200 209