]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - client/webpack/webpack.video-embed.js
Translated using Weblate (Vietnamese)
[github/Chocobozzz/PeerTube.git] / client / webpack / webpack.video-embed.js
index b20a2187280ea735f9878edfdb2bab5b2685af2e..7de63adfcc40adc54ab52dd165d274fe45b3da04 100644 (file)
@@ -4,7 +4,6 @@ const path = require('path')
 const HtmlWebpackPlugin = require('html-webpack-plugin')
 const TerserPlugin = require('terser-webpack-plugin')
 const LoaderOptionsPlugin = require('webpack/lib/LoaderOptionsPlugin')
-const PurifyCSSPlugin = require('purifycss-webpack')
 const MiniCssExtractPlugin = require('mini-css-extract-plugin')
 
 module.exports = function () {
@@ -23,7 +22,7 @@ module.exports = function () {
        */
       extensions: [ '.ts', '.js', '.json', '.scss' ],
 
-      modules: [ helpers.root('src'), helpers.root('node_modules') ],
+      modules: [ helpers.root('src'), 'node_modules' ],
 
       alias: {
         'video.js$': path.resolve('node_modules/video.js/core.js'),
@@ -41,7 +40,11 @@ module.exports = function () {
         : '[name].[hash].bundle.js',
 
       sourceMapFilename: '[file].map',
-      chunkFilename: '[id].[hash].chunk.js',
+
+      chunkFilename: process.env.ANALYZE_BUNDLE === 'true'
+        ? '[name].chunk.js'
+        : '[id].[hash].chunk.js',
+
       publicPath: '/client/standalone/videos/'
     },
 
@@ -117,24 +120,21 @@ module.exports = function () {
           : '[name].[hash].css'
       }),
 
-      new PurifyCSSPlugin({
-        paths: [
-          helpers.root('src/standalone/videos/embed.ts'),
-          helpers.root('src/standalone/videos/test-embed.html')
-        ],
-        purifyOptions: {
-          minify: true,
-          whitelist: [ '*vjs*', '*video-js*' ]
-        }
-      }),
-
       new HtmlWebpackPlugin({
         template: 'src/standalone/videos/embed.html',
         filename: 'embed.html',
         title: 'PeerTube',
         chunksSortMode: 'auto',
         inject: 'body',
-        chunks: ['video-embed']
+        chunks: ['video-embed'],
+        minify: {
+          collapseWhitespace: true,
+          removeComments: false,
+          removeRedundantAttributes: true,
+          removeScriptTypeAttributes: true,
+          removeStyleLinkTypeAttributes: true,
+          useShortDoctype: true
+        }
       }),
 
       new HtmlWebpackPlugin({