]>
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 LoaderOptionsPlugin
= require('webpack/lib/LoaderOptionsPlugin')
7 const ExtractTextPlugin
= require('extract-text-webpack-plugin')
8 const PurifyCSSPlugin
= require('purifycss-webpack')
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'), helpers
.root('node_modules') ],
29 'video.js$': path
.resolve('node_modules/video.js/core.js'),
30 '@root-helpers': path
.resolve('src/root-helpers'),
31 '@shared/models': path
.resolve('../shared/models'),
36 path: helpers
.root('dist/standalone/videos'),
38 filename: process
.env
.ANALYZE_BUNDLE
=== 'true'
40 : '[name].[hash].bundle.js',
42 sourceMapFilename: '[file].map',
43 chunkFilename: '[id].[hash].chunk.js',
44 publicPath: '/client/standalone/videos/'
47 devtool: process
.env
.NODE_ENV
=== 'production' ? false : 'source-map',
58 configFile: 'tsconfig.base.json'
65 test: /\.(sass|scss)$/,
66 use: ExtractTextPlugin
.extract({
67 fallback: 'style-loader',
77 loader: 'sass-loader',
82 helpers
.root('src/sass/include')
95 helpers
.root('src/index.html'),
96 helpers
.root('src/standalone/videos/embed.html'),
97 helpers
.root('src/standalone/videos/test-embed.html')
102 test: /\.(jpg|png|gif)$/,
106 { test: /\.woff(2)?(\?v=[0-9]\.[0-9]\.[0-9])?$/, use: 'url-loader?limit=10000&minetype=application/font-woff' },
107 { test: /\.(ttf|eot|svg)(\?v=[0-9]\.[0-9]\.[0-9])?$/, use: 'file-loader' }
113 new ExtractTextPlugin({
114 filename: process
.env
.ANALYZE_BUNDLE
=== 'true'
116 : '[name].[hash].css'
119 new PurifyCSSPlugin({
121 helpers
.root('src/standalone/videos/embed.ts'),
122 helpers
.root('src/standalone/videos/test-embed.html')
126 whitelist: [ '*vjs*', '*video-js*' ]
130 new HtmlWebpackPlugin({
131 template: 'src/standalone/videos/embed.html',
132 filename: 'embed.html',
134 chunksSortMode: 'auto',
136 chunks: ['video-embed']
139 new HtmlWebpackPlugin({
140 template: '!!html-loader!src/standalone/videos/test-embed.html',
141 filename: 'test-embed.html',
143 chunksSortMode: 'auto',
145 chunks: ['test-embed']
149 * Plugin LoaderOptionsPlugin (experimental)
151 * See: https://gist.github.com/sokra/27b24881210b56bbaff7
153 new LoaderOptionsPlugin({
157 path: helpers
.root('dist')
185 maxEntrypointSize: 700000, // 600kB
195 clearImmediate: false,