]>
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',
44 chunkFilename: process
.env
.ANALYZE_BUNDLE
=== 'true'
46 : '[id].[hash].chunk.js',
48 publicPath: '/client/standalone/videos/'
51 devtool: process
.env
.NODE_ENV
=== 'production' ? false : 'source-map',
62 configFile: 'tsconfig.base.json'
69 test: /\.(sass|scss)$/,
71 MiniCssExtractPlugin
.loader
,
82 loader: 'sass-loader',
87 helpers
.root('src/sass/include')
99 helpers
.root('src/index.html'),
100 helpers
.root('src/standalone/videos/embed.html'),
101 helpers
.root('src/standalone/videos/test-embed.html')
106 test: /\.(jpg|png|gif)$/,
110 { test: /\.woff(2)?(\?v=[0-9]\.[0-9]\.[0-9])?$/, use: 'url-loader?limit=10000&minetype=application/font-woff' },
111 { test: /\.(ttf|eot|svg)(\?v=[0-9]\.[0-9]\.[0-9])?$/, use: 'file-loader' }
117 new MiniCssExtractPlugin({
118 filename: process
.env
.ANALYZE_BUNDLE
=== 'true'
120 : '[name].[hash].css'
123 new HtmlWebpackPlugin({
124 template: 'src/standalone/videos/embed.html',
125 filename: 'embed.html',
127 chunksSortMode: 'auto',
129 chunks: ['video-embed'],
131 collapseWhitespace: true,
132 removeComments: false,
133 removeRedundantAttributes: true,
134 removeScriptTypeAttributes: true,
135 removeStyleLinkTypeAttributes: true,
136 useShortDoctype: true
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,