]>
git.immae.eu Git - github/Chocobozzz/PeerTube.git/blob - client/webpack/webpack.video-embed.js
e7671d3ea1a31842e171d720401d0d29f7c9c6ff
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/core.js')
35 path: helpers
.root('dist/standalone/videos'),
37 filename: process
.env
.ANALYZE_BUNDLE
=== 'true'
39 : '[name].[hash].bundle.js',
41 sourceMapFilename: '[file].map',
42 chunkFilename: '[id].[hash].chunk.js',
43 publicPath: '/client/standalone/videos/'
46 devtool: process
.env
.NODE_ENV
=== 'production' ? false : 'source-map',
55 loader: 'awesome-typescript-loader',
57 configFileName: 'tsconfig.json'
61 exclude: [/\.(spec|e2e)\.ts$/]
65 test: /\.(sass|scss)$/,
66 use: ExtractTextPlugin
.extract({
67 fallback: 'style-loader',
77 // loader: 'resolve-url-loader',
83 loader: 'sass-loader',
88 helpers
.root('src/sass/include')
101 helpers
.root('src/index.html'),
102 helpers
.root('src/standalone/videos/embed.html'),
103 helpers
.root('src/standalone/videos/test-embed.html')
108 test: /\.(jpg|png|gif)$/,
112 { test: /\.woff(2)?(\?v=[0-9]\.[0-9]\.[0-9])?$/, use: 'url-loader?limit=10000&minetype=application/font-woff' },
113 { test: /\.(ttf|eot|svg)(\?v=[0-9]\.[0-9]\.[0-9])?$/, use: 'file-loader' }
119 new ExtractTextPlugin({
120 filename: process
.env
.ANALYZE_BUNDLE
=== 'true'
122 : '[name].[hash].css'
125 new PurifyCSSPlugin({
127 helpers
.root('src/standalone/videos/embed.ts'),
128 helpers
.root('src/standalone/videos/test-embed.html')
132 whitelist: [ '*vjs*', '*video-js*' ]
138 new HtmlWebpackPlugin({
139 template: 'src/standalone/videos/embed.html',
140 filename: 'embed.html',
142 chunksSortMode: 'auto',
144 chunks: ['video-embed']
147 new HtmlWebpackPlugin({
148 template: '!!html-loader!src/standalone/videos/test-embed.html',
149 filename: 'test-embed.html',
151 chunksSortMode: 'auto',
153 chunks: ['test-embed']
157 * Plugin LoaderOptionsPlugin (experimental)
159 * See: https://gist.github.com/sokra/27b24881210b56bbaff7
161 new LoaderOptionsPlugin({
165 path: helpers
.root('dist')
193 maxEntrypointSize: 700000, // 600kB
203 clearImmediate: false,