]>
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 CheckerPlugin
= require('awesome-typescript-loader').CheckerPlugin
5 const HtmlWebpackPlugin
= require('html-webpack-plugin')
6 const TerserPlugin
= require('terser-webpack-plugin')
7 const LoaderOptionsPlugin
= require('webpack/lib/LoaderOptionsPlugin')
8 const ExtractTextPlugin
= require('extract-text-webpack-plugin')
9 const PurifyCSSPlugin
= require('purifycss-webpack')
11 module
.exports = function () {
12 const configuration
= {
14 'video-embed': './src/standalone/videos/embed.ts',
15 'player': './src/standalone/player/player.ts',
16 'test-embed': './src/standalone/videos/test-embed.ts'
21 * An array of extensions that should be used to resolve modules.
23 * See: http://webpack.github.io/docs/configuration.html#resolve-extensions
25 extensions: [ '.ts', '.js', '.json', '.scss' ],
27 modules: [ helpers
.root('src'), helpers
.root('node_modules') ],
30 'video.js$': path
.resolve('node_modules/video.js/dist/alt/video.core.js')
35 path: helpers
.root('dist/standalone/videos'),
36 filename: '[name].[hash].bundle.js',
37 sourceMapFilename: '[file].map',
38 chunkFilename: '[id].chunk.js',
39 publicPath: '/client/standalone/videos/'
42 devtool: process
.env
.NODE_ENV
=== 'production' ? false : 'source-map',
51 loader: 'awesome-typescript-loader',
53 configFileName: 'tsconfig.json'
57 exclude: [/\.(spec|e2e)\.ts$/]
61 test: /\.(sass|scss)$/,
62 use: ExtractTextPlugin
.extract({
63 fallback: 'style-loader',
73 // loader: 'resolve-url-loader',
79 loader: 'sass-loader',
83 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: '[name].[hash].css'
117 new PurifyCSSPlugin({
119 helpers
.root('src/standalone/videos/embed.ts'),
120 helpers
.root('src/standalone/videos/test-embed.html')
124 whitelist: [ '*vjs*', '*video-js*' ]
130 new HtmlWebpackPlugin({
131 template: 'src/standalone/videos/embed.html',
132 filename: 'embed.html',
134 chunksSortMode: 'dependency',
136 chunks: ['video-embed']
139 new HtmlWebpackPlugin({
140 template: '!!html-loader!src/standalone/videos/test-embed.html',
141 filename: 'test-embed.html',
143 chunksSortMode: 'dependency',
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,