]>
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 ProvidePlugin
= require('webpack/lib/ProvidePlugin')
8 const MiniCssExtractPlugin
= require('mini-css-extract-plugin')
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'), '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')
36 fs: [ path
.resolve('src/shims/noop.ts') ],
37 http: [ path
.resolve('src/shims/http.ts') ],
38 https: [ path
.resolve('src/shims/https.ts') ],
39 path: [ path
.resolve('src/shims/path.ts') ],
40 stream: [ path
.resolve('src/shims/noop.ts') ],
41 crypto: [ path
.resolve('src/shims/noop.ts') ]
46 path: helpers
.root('dist/standalone/videos'),
48 filename: process
.env
.ANALYZE_BUNDLE
=== 'true'
50 : '[name].[contenthash].bundle.js',
52 sourceMapFilename: '[file].map',
54 chunkFilename: process
.env
.ANALYZE_BUNDLE
=== 'true'
56 : '[id].[contenthash].chunk.js',
58 publicPath: '/client/standalone/videos/'
61 devtool: process
.env
.NODE_ENV
=== 'production' ? false : 'source-map',
72 configFile: 'tsconfig.base.json'
79 test: /\.(sass|scss)$/,
81 MiniCssExtractPlugin
.loader
,
92 loader: 'sass-loader',
97 helpers
.root('src/sass/include')
109 helpers
.root('src/index.html'),
110 helpers
.root('src/standalone/videos/embed.html'),
111 helpers
.root('src/standalone/videos/test-embed.html')
116 test: /\.(jpg|png|gif)$/,
120 { test: /\.woff(2)?(\?v=[0-9]\.[0-9]\.[0-9])?$/, use: 'url-loader?limit=10000&minetype=application/font-woff' },
121 { test: /\.(ttf|eot|svg)(\?v=[0-9]\.[0-9]\.[0-9])?$/, use: 'file-loader' }
128 process: 'process/browser',
129 Buffer: [ 'buffer', 'Buffer' ]
132 new MiniCssExtractPlugin({
133 filename: process
.env
.ANALYZE_BUNDLE
=== 'true'
135 : '[name].[contenthash].css'
138 new HtmlWebpackPlugin({
139 template: 'src/standalone/videos/embed.html',
140 filename: 'embed.html',
142 chunksSortMode: 'auto',
144 chunks: [ 'video-embed' ],
146 collapseWhitespace: true,
147 removeComments: false,
148 removeRedundantAttributes: true,
149 removeScriptTypeAttributes: true,
150 removeStyleLinkTypeAttributes: true,
151 useShortDoctype: true
155 new HtmlWebpackPlugin({
156 template: '!!html-loader!src/standalone/videos/test-embed.html',
157 filename: 'test-embed.html',
159 chunksSortMode: 'auto',
161 chunks: [ 'test-embed' ]
165 * Plugin LoaderOptionsPlugin (experimental)
167 * See: https://gist.github.com/sokra/27b24881210b56bbaff7
169 new LoaderOptionsPlugin({
173 path: helpers
.root('dist')
201 maxEntrypointSize: 700000, // 600kB