]>
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'),
32 '@shared/core-utils': path
.resolve('../shared/core-utils')
37 path: helpers
.root('dist/standalone/videos'),
39 filename: process
.env
.ANALYZE_BUNDLE
=== 'true'
41 : '[name].[hash].bundle.js',
43 sourceMapFilename: '[file].map',
44 chunkFilename: '[id].[hash].chunk.js',
45 publicPath: '/client/standalone/videos/'
48 devtool: process
.env
.NODE_ENV
=== 'production' ? false : 'source-map',
59 configFile: 'tsconfig.base.json'
66 test: /\.(sass|scss)$/,
67 use: ExtractTextPlugin
.extract({
68 fallback: 'style-loader',
78 loader: 'sass-loader',
83 helpers
.root('src/sass/include')
96 helpers
.root('src/index.html'),
97 helpers
.root('src/standalone/videos/embed.html'),
98 helpers
.root('src/standalone/videos/test-embed.html')
103 test: /\.(jpg|png|gif)$/,
107 { test: /\.woff(2)?(\?v=[0-9]\.[0-9]\.[0-9])?$/, use: 'url-loader?limit=10000&minetype=application/font-woff' },
108 { test: /\.(ttf|eot|svg)(\?v=[0-9]\.[0-9]\.[0-9])?$/, use: 'file-loader' }
114 new ExtractTextPlugin({
115 filename: process
.env
.ANALYZE_BUNDLE
=== 'true'
117 : '[name].[hash].css'
120 new PurifyCSSPlugin({
122 helpers
.root('src/standalone/videos/embed.ts'),
123 helpers
.root('src/standalone/videos/test-embed.html')
127 whitelist: [ '*vjs*', '*video-js*' ]
131 new HtmlWebpackPlugin({
132 template: 'src/standalone/videos/embed.html',
133 filename: 'embed.html',
135 chunksSortMode: 'auto',
137 chunks: ['video-embed']
140 new HtmlWebpackPlugin({
141 template: '!!html-loader!src/standalone/videos/test-embed.html',
142 filename: 'test-embed.html',
144 chunksSortMode: 'auto',
146 chunks: ['test-embed']
150 * Plugin LoaderOptionsPlugin (experimental)
152 * See: https://gist.github.com/sokra/27b24881210b56bbaff7
154 new LoaderOptionsPlugin({
158 path: helpers
.root('dist')
186 maxEntrypointSize: 700000, // 600kB
196 clearImmediate: false,