]>
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' ],
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')
81 loader: 'babel-loader',
85 '@babel/preset-env', {
86 targets: 'last 1 Chrome version, last 2 Edge major versions, Firefox ESR, Safari >= 11, ios_saf >= 11'
96 test: /\.(sass|scss)$/,
98 MiniCssExtractPlugin
.loader
,
101 loader: 'css-loader',
109 loader: 'sass-loader',
114 helpers
.root('src/sass/include')
125 helpers
.root('src/index.html'),
126 helpers
.root('src/standalone/videos/embed.html'),
127 helpers
.root('src/standalone/videos/test-embed.html')
133 test: /\.(jpg|png|gif|svg)$/,
138 test: /\.(ttf|eot|woff2?)$/,
147 process: 'process/browser',
148 Buffer: [ 'buffer', 'Buffer' ]
151 new MiniCssExtractPlugin({
152 filename: process
.env
.ANALYZE_BUNDLE
=== 'true'
154 : '[name].[contenthash].css'
157 new HtmlWebpackPlugin({
158 template: 'src/standalone/videos/embed.html',
159 filename: 'embed.html',
161 chunksSortMode: 'auto',
163 chunks: [ 'video-embed' ],
165 collapseWhitespace: true,
166 removeComments: false,
167 removeRedundantAttributes: true,
168 removeScriptTypeAttributes: true,
169 removeStyleLinkTypeAttributes: true,
170 useShortDoctype: true
174 new HtmlWebpackPlugin({
175 template: '!!html-loader!src/standalone/videos/test-embed.html',
176 filename: 'test-embed.html',
178 chunksSortMode: 'auto',
180 chunks: [ 'test-embed' ]
207 maxEntrypointSize: 700000, // 600kB