]>
git.immae.eu Git - github/Chocobozzz/PeerTube.git/blob - webpack.video-embed.js
8cd606b39310201cc7f6f838db3e37a6086ab3e9
1 const helpers
= require('./helpers')
2 const path
= require('path')
4 const HtmlWebpackPlugin
= require('html-webpack-plugin')
5 const TerserPlugin
= require('terser-webpack-plugin')
6 const ProvidePlugin
= require('webpack/lib/ProvidePlugin')
7 const MiniCssExtractPlugin
= require('mini-css-extract-plugin')
9 module
.exports = function () {
10 const configuration
= {
12 'video-embed': './src/standalone/videos/embed.ts',
13 'player': './src/standalone/player/player.ts',
14 'test-embed': './src/standalone/videos/test-embed.ts'
19 * An array of extensions that should be used to resolve modules.
21 * See: http://webpack.github.io/docs/configuration.html#resolve-extensions
23 extensions: [ '.ts', '.js', '.json', '.scss' ],
25 modules: [ helpers
.root('src'), 'node_modules' ],
28 'video.js$': path
.resolve('node_modules/video.js/core.js'),
29 'hls.js$': path
.resolve('node_modules/hls.js/dist/hls.light.js'),
30 '@root-helpers': path
.resolve('src/root-helpers'),
31 '@shared/models': path
.resolve('../shared/models'),
32 '@shared/core-utils': path
.resolve('../shared/core-utils')
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/stream.ts') ],
41 crypto: [ path
.resolve('src/shims/noop.ts') ]
46 path: helpers
.root('dist/standalone/videos'),
48 filename: process
.env
.ANALYZE_BUNDLE
=== 'true'
50 : '[name].[contenthash].bundle.js',
52 sourceMapFilename: '[file].map',
54 chunkFilename: process
.env
.ANALYZE_BUNDLE
=== 'true'
56 : '[id].[contenthash].chunk.js',
58 publicPath: '/client/standalone/videos/'
61 devtool: process
.env
.NODE_ENV
=== 'production' ? false : 'source-map',
72 configFile: helpers
.root('tsconfig.json')
79 test: /\.(sass|scss)$/,
81 MiniCssExtractPlugin
.loader
,
92 loader: 'sass-loader',
97 helpers
.root('src/sass/include')
108 helpers
.root('src/index.html'),
109 helpers
.root('src/standalone/videos/embed.html'),
110 helpers
.root('src/standalone/videos/test-embed.html')
116 test: /\.(jpg|png|gif|svg)$/,
121 test: /\.(ttf|eot|woff2?)$/,
130 process: 'process/browser',
131 Buffer: [ 'buffer', 'Buffer' ]
134 new MiniCssExtractPlugin({
135 filename: process
.env
.ANALYZE_BUNDLE
=== 'true'
137 : '[name].[contenthash].css'
140 new HtmlWebpackPlugin({
141 template: 'src/standalone/videos/embed.html',
142 filename: 'embed.html',
144 chunksSortMode: 'auto',
146 chunks: [ 'video-embed' ],
148 collapseWhitespace: true,
149 removeComments: false,
150 removeRedundantAttributes: true,
151 removeScriptTypeAttributes: true,
152 removeStyleLinkTypeAttributes: true,
153 useShortDoctype: true
157 new HtmlWebpackPlugin({
158 template: '!!html-loader!src/standalone/videos/test-embed.html',
159 filename: 'test-embed.html',
161 chunksSortMode: 'auto',
163 chunks: [ 'test-embed' ]
189 maxEntrypointSize: 700000, // 600kB