]>
git.immae.eu Git - github/Chocobozzz/PeerTube.git/blob - client/webpack/webpack.video-embed.js
8320d01e71d5d3bd49cecced17809da12784228e
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 LoaderOptionsPlugin
= require('webpack/lib/LoaderOptionsPlugin')
7 const ProvidePlugin
= require('webpack/lib/ProvidePlugin')
8 const MiniCssExtractPlugin
= require('mini-css-extract-plugin')
10 module
.exports = function () {
11 const configuration
= {
13 'video-embed': './src/standalone/videos/embed.ts',
14 'player': './src/standalone/player/player.ts',
15 'test-embed': './src/standalone/videos/test-embed.ts'
20 * An array of extensions that should be used to resolve modules.
22 * See: http://webpack.github.io/docs/configuration.html#resolve-extensions
24 extensions: [ '.ts', '.js', '.json', '.scss' ],
26 modules: [ helpers
.root('src'), 'node_modules' ],
29 'video.js$': path
.resolve('node_modules/video.js/core.js'),
30 'hls.js$': path
.resolve('node_modules/hls.js/dist/hls.light.js'),
31 '@root-helpers': path
.resolve('src/root-helpers'),
32 '@shared/models': path
.resolve('../shared/models'),
33 '@shared/core-utils': path
.resolve('../shared/core-utils')
37 fs: [ path
.resolve('src/shims/noop.ts') ],
38 http: [ path
.resolve('src/shims/http.ts') ],
39 https: [ path
.resolve('src/shims/https.ts') ],
40 path: [ path
.resolve('src/shims/path.ts') ],
41 stream: [ path
.resolve('src/shims/stream.ts') ],
42 crypto: [ path
.resolve('src/shims/noop.ts') ]
47 path: helpers
.root('dist/standalone/videos'),
49 filename: process
.env
.ANALYZE_BUNDLE
=== 'true'
51 : '[name].[contenthash].bundle.js',
53 sourceMapFilename: '[file].map',
55 chunkFilename: process
.env
.ANALYZE_BUNDLE
=== 'true'
57 : '[id].[contenthash].chunk.js',
59 publicPath: '/client/standalone/videos/'
62 devtool: process
.env
.NODE_ENV
=== 'production' ? false : 'source-map',
73 configFile: 'tsconfig.json'
80 test: /\.(sass|scss)$/,
82 MiniCssExtractPlugin
.loader
,
93 loader: 'sass-loader',
98 helpers
.root('src/sass/include')
109 helpers
.root('src/index.html'),
110 helpers
.root('src/standalone/videos/embed.html'),
111 helpers
.root('src/standalone/videos/test-embed.html')
117 test: /\.(jpg|png|gif|svg)$/,
122 test: /\.(ttf|eot|woff2?)$/,
131 process: 'process/browser',
132 Buffer: [ 'buffer', 'Buffer' ]
135 new MiniCssExtractPlugin({
136 filename: process
.env
.ANALYZE_BUNDLE
=== 'true'
138 : '[name].[contenthash].css'
141 new HtmlWebpackPlugin({
142 template: 'src/standalone/videos/embed.html',
143 filename: 'embed.html',
145 chunksSortMode: 'auto',
147 chunks: [ 'video-embed' ],
149 collapseWhitespace: true,
150 removeComments: false,
151 removeRedundantAttributes: true,
152 removeScriptTypeAttributes: true,
153 removeStyleLinkTypeAttributes: true,
154 useShortDoctype: true
158 new HtmlWebpackPlugin({
159 template: '!!html-loader!src/standalone/videos/test-embed.html',
160 filename: 'test-embed.html',
162 chunksSortMode: 'auto',
164 chunks: [ 'test-embed' ]
168 * Plugin LoaderOptionsPlugin (experimental)
170 * See: https://gist.github.com/sokra/27b24881210b56bbaff7
172 new LoaderOptionsPlugin({
176 path: helpers
.root('dist')
204 maxEntrypointSize: 700000, // 600kB