]>
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 MiniCssExtractPlugin
= require('mini-css-extract-plugin')
9 module
.exports = function () {
10 const configuration
= {
12 'video-embed': './src/standalone/videos/embed.ts',
13 'player': './src/standalone/player/player.ts',
14 'test-embed': './src/standalone/videos/test-embed.ts'
19 * An array of extensions that should be used to resolve modules.
21 * See: http://webpack.github.io/docs/configuration.html#resolve-extensions
23 extensions: [ '.ts', '.js', '.json', '.scss' ],
25 modules: [ helpers
.root('src'), 'node_modules' ],
28 'video.js$': path
.resolve('node_modules/video.js/core.js'),
29 '@root-helpers': path
.resolve('src/root-helpers'),
30 '@shared/models': path
.resolve('../shared/models'),
31 '@shared/core-utils': path
.resolve('../shared/core-utils')
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)$/,
67 MiniCssExtractPlugin
.loader
,
78 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 MiniCssExtractPlugin({
114 filename: process
.env
.ANALYZE_BUNDLE
=== 'true'
116 : '[name].[hash].css'
119 new HtmlWebpackPlugin({
120 template: 'src/standalone/videos/embed.html',
121 filename: 'embed.html',
123 chunksSortMode: 'auto',
125 chunks: ['video-embed'],
127 collapseWhitespace: true,
128 removeComments: false,
129 removeRedundantAttributes: true,
130 removeScriptTypeAttributes: true,
131 removeStyleLinkTypeAttributes: true,
132 useShortDoctype: true
136 new HtmlWebpackPlugin({
137 template: '!!html-loader!src/standalone/videos/test-embed.html',
138 filename: 'test-embed.html',
140 chunksSortMode: 'auto',
142 chunks: ['test-embed']
146 * Plugin LoaderOptionsPlugin (experimental)
148 * See: https://gist.github.com/sokra/27b24881210b56bbaff7
150 new LoaderOptionsPlugin({
154 path: helpers
.root('dist')
182 maxEntrypointSize: 700000, // 600kB
192 clearImmediate: false,