]>
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 UglifyJsPlugin
= require('uglifyjs-webpack-plugin')
7 const HashedModuleIdsPlugin
= require('webpack/lib/HashedModuleIdsPlugin')
8 const LoaderOptionsPlugin
= require('webpack/lib/LoaderOptionsPlugin')
9 const ExtractTextPlugin
= require('extract-text-webpack-plugin')
10 const PurifyCSSPlugin
= require('purifycss-webpack')
12 module
.exports = function () {
13 const isProd
= process
.env
.NODE_ENV
=== 'production'
15 const configuration
= {
17 'video-embed': './src/standalone/videos/embed.ts',
18 'player': './src/standalone/player/player.ts',
19 'test-embed': './src/standalone/videos/test-embed.ts'
24 * An array of extensions that should be used to resolve modules.
26 * See: http://webpack.github.io/docs/configuration.html#resolve-extensions
28 extensions: [ '.ts', '.js', '.json', '.scss' ],
30 modules: [ helpers
.root('src'), helpers
.root('node_modules') ],
33 'video.js$': path
.resolve('node_modules/video.js/dist/alt/video.core.js')
38 path: helpers
.root('dist/standalone/videos'),
39 filename: '[name].[hash].bundle.js',
40 sourceMapFilename: '[file].map',
41 chunkFilename: '[id].chunk.js',
42 publicPath: '/client/standalone/videos/'
45 // devtool: 'source-map',
54 loader: 'awesome-typescript-loader',
56 configFileName: 'tsconfig.json'
60 exclude: [/\.(spec|e2e)\.ts$/]
64 test: /\.(sass|scss)$/,
65 use: ExtractTextPlugin
.extract({
66 fallback: 'style-loader',
77 loader: 'sass-loader',
81 helpers
.root('src/sass/include')
93 helpers
.root('src/index.html'),
94 helpers
.root('src/standalone/videos/embed.html'),
95 helpers
.root('src/standalone/videos/test-embed.html')
100 test: /\.(jpg|png|gif)$/,
104 { test: /\.woff(2)?(\?v=[0-9]\.[0-9]\.[0-9])?$/, use: 'url-loader?limit=10000&minetype=application/font-woff' },
105 { test: /\.(ttf|eot|svg)(\?v=[0-9]\.[0-9]\.[0-9])?$/, use: 'file-loader' }
111 new ExtractTextPlugin({
112 filename: '[name].[hash].css'
115 new PurifyCSSPlugin({
117 helpers
.root('src/standalone/videos/embed.ts'),
118 helpers
.root('src/standalone/videos/test-embed.html')
122 whitelist: [ '*vjs*', '*video-js*' ]
128 new HtmlWebpackPlugin({
129 template: 'src/standalone/videos/embed.html',
130 filename: 'embed.html',
132 chunksSortMode: 'dependency',
134 chunks: ['video-embed']
137 new HtmlWebpackPlugin({
138 template: '!!html-loader!src/standalone/videos/test-embed.html',
139 filename: 'test-embed.html',
141 chunksSortMode: 'dependency',
143 chunks: ['test-embed']
147 * Plugin LoaderOptionsPlugin (experimental)
149 * See: https://gist.github.com/sokra/27b24881210b56bbaff7
151 new LoaderOptionsPlugin({
155 path: helpers
.root('dist')
162 maxEntrypointSize: 700000, // 600kB
172 clearImmediate: false,
178 configuration
.plugins
.push(
196 new HashedModuleIdsPlugin()