]>
git.immae.eu Git - github/Chocobozzz/PeerTube.git/blob - client/webpack/webpack.video-embed.js
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' ],
30 'video.js$': path
.resolve('node_modules/video.js/core.js'),
31 'hls.js$': path
.resolve('node_modules/hls.js/dist/hls.light.js'),
32 '@root-helpers': path
.resolve('src/root-helpers'),
33 '@shared/models': path
.resolve('../shared/models'),
34 '@shared/core-utils': path
.resolve('../shared/core-utils')
38 fs: [ path
.resolve('src/shims/noop.ts') ],
39 http: [ path
.resolve('src/shims/http.ts') ],
40 https: [ path
.resolve('src/shims/https.ts') ],
41 path: [ path
.resolve('src/shims/path.ts') ],
42 stream: [ path
.resolve('src/shims/stream.ts') ],
43 crypto: [ path
.resolve('src/shims/noop.ts') ]
48 path: helpers
.root('dist/standalone/videos'),
50 filename: process
.env
.ANALYZE_BUNDLE
=== 'true'
52 : '[name].[contenthash].bundle.js',
54 sourceMapFilename: '[file].map',
56 chunkFilename: process
.env
.ANALYZE_BUNDLE
=== 'true'
58 : '[id].[contenthash].chunk.js',
60 publicPath: '/client/standalone/videos/'
63 devtool: process
.env
.NODE_ENV
=== 'production' ? false : 'source-map',
74 configFile: helpers
.root('src/standalone/videos/tsconfig.json')
83 loader: 'babel-loader',
87 '@babel/preset-env', {
88 targets: 'last 1 Chrome version, last 2 Edge major versions, Firefox ESR, Safari >= 11, ios_saf >= 11'
98 test: /\.(sass|scss)$/,
100 MiniCssExtractPlugin
.loader
,
103 loader: 'css-loader',
111 loader: 'sass-loader',
116 helpers
.root('src/sass/include')
127 helpers
.root('src/index.html'),
128 helpers
.root('src/standalone/videos/embed.html'),
129 helpers
.root('src/standalone/videos/test-embed.html')
135 test: /\.(jpg|png|gif|svg)$/,
140 test: /\.(ttf|eot|woff2?)$/,
149 process: 'process/browser',
150 Buffer: [ 'buffer', 'Buffer' ]
153 new MiniCssExtractPlugin({
154 filename: process
.env
.ANALYZE_BUNDLE
=== 'true'
156 : '[name].[contenthash].css'
159 new HtmlWebpackPlugin({
160 template: 'src/standalone/videos/embed.html',
161 filename: 'embed.html',
163 chunksSortMode: 'auto',
165 chunks: [ 'video-embed' ],
167 collapseWhitespace: true,
168 removeComments: false,
169 removeRedundantAttributes: true,
170 removeScriptTypeAttributes: true,
171 removeStyleLinkTypeAttributes: true,
172 useShortDoctype: true
176 new HtmlWebpackPlugin({
177 template: '!!html-loader!src/standalone/videos/test-embed.html',
178 filename: 'test-embed.html',
180 chunksSortMode: 'auto',
182 chunks: [ 'test-embed' ]
209 maxEntrypointSize: 700000, // 600kB