]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - client/webpack/webpack.video-embed.js
Remove solution style ts config
[github/Chocobozzz/PeerTube.git] / client / webpack / webpack.video-embed.js
index d578443fe925174bfe7e7b4bd6e1c914d66f61e6..2ecbd09afc1300c2417d3306dec8e5587f83aca8 100644 (file)
@@ -4,6 +4,7 @@ const path = require('path')
 const HtmlWebpackPlugin = require('html-webpack-plugin')
 const TerserPlugin = require('terser-webpack-plugin')
 const LoaderOptionsPlugin = require('webpack/lib/LoaderOptionsPlugin')
+const ProvidePlugin = require('webpack/lib/ProvidePlugin')
 const MiniCssExtractPlugin = require('mini-css-extract-plugin')
 
 module.exports = function () {
@@ -22,13 +23,23 @@ 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'),
+        'hls.js$': path.resolve('node_modules/hls.js/dist/hls.light.js'),
         '@root-helpers': path.resolve('src/root-helpers'),
         '@shared/models': path.resolve('../shared/models'),
         '@shared/core-utils': path.resolve('../shared/core-utils')
+      },
+
+      fallback: {
+        fs: [ path.resolve('src/shims/noop.ts') ],
+        http: [ path.resolve('src/shims/http.ts') ],
+        https: [ path.resolve('src/shims/https.ts') ],
+        path: [ path.resolve('src/shims/path.ts') ],
+        stream: [ path.resolve('src/shims/stream.ts') ],
+        crypto: [ path.resolve('src/shims/noop.ts') ]
       }
     },
 
@@ -37,10 +48,14 @@ module.exports = function () {
 
       filename: process.env.ANALYZE_BUNDLE === 'true'
         ? '[name].bundle.js'
-        : '[name].[hash].bundle.js',
+        : '[name].[contenthash].bundle.js',
 
       sourceMapFilename: '[file].map',
-      chunkFilename: '[id].[hash].chunk.js',
+
+      chunkFilename: process.env.ANALYZE_BUNDLE === 'true'
+        ? '[name].chunk.js'
+        : '[id].[contenthash].chunk.js',
+
       publicPath: '/client/standalone/videos/'
     },
 
@@ -55,7 +70,7 @@ module.exports = function () {
             {
               loader: 'ts-loader',
               options: {
-                configFile: 'tsconfig.base.json'
+                configFile: 'tsconfig.json'
               }
             }
           ]
@@ -110,10 +125,15 @@ module.exports = function () {
     },
 
     plugins: [
+      new ProvidePlugin({
+        process: 'process/browser',
+        Buffer: [ 'buffer', 'Buffer' ]
+      }),
+
       new MiniCssExtractPlugin({
         filename: process.env.ANALYZE_BUNDLE === 'true'
           ? '[name].css'
-          : '[name].[hash].css'
+          : '[name].[contenthash].css'
       }),
 
       new HtmlWebpackPlugin({
@@ -122,7 +142,7 @@ module.exports = function () {
         title: 'PeerTube',
         chunksSortMode: 'auto',
         inject: 'body',
-        chunks: ['video-embed'],
+        chunks: [ 'video-embed' ],
         minify: {
           collapseWhitespace: true,
           removeComments: false,
@@ -139,7 +159,7 @@ module.exports = function () {
         title: 'PeerTube',
         chunksSortMode: 'auto',
         inject: 'body',
-        chunks: ['test-embed']
+        chunks: [ 'test-embed' ]
       }),
 
       /**
@@ -184,13 +204,7 @@ module.exports = function () {
     },
 
     node: {
-      global: true,
-      crypto: 'empty',
-      fs: 'empty',
-      process: true,
-      module: false,
-      clearImmediate: false,
-      setImmediate: false
+      global: true
     }
   }