]>
git.immae.eu Git - github/Chocobozzz/PeerTube.git/blob - client/webpack/webpack.video-embed.js
1 const helpers
= require('./helpers')
3 const CheckerPlugin
= require('awesome-typescript-loader').CheckerPlugin
4 const HtmlWebpackPlugin
= require('html-webpack-plugin')
5 const UglifyJsPlugin
= require('uglifyjs-webpack-plugin')
6 const HashedModuleIdsPlugin
= require('webpack/lib/HashedModuleIdsPlugin')
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 isProd
= process
.env
.NODE_ENV
=== 'production'
14 const configuration
= {
16 'video-embed': './src/standalone/videos/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') ]
31 path: helpers
.root('dist/standalone/videos'),
32 filename: '[name].[hash].bundle.js',
33 sourceMapFilename: '[file].map',
34 chunkFilename: '[id].chunk.js',
35 publicPath: '/client/standalone/videos/'
45 loader: 'awesome-typescript-loader',
47 configFileName: 'tsconfig.json'
51 exclude: [/\.(spec|e2e)\.ts$/]
55 test: /\.(sass|scss)$/,
56 use: ExtractTextPlugin
.extract({
57 fallback: 'style-loader',
68 loader: 'sass-loader',
72 helpers
.root('src/sass/include')
84 helpers
.root('src/index.html'),
85 helpers
.root('src/standalone/videos/embed.html')
90 test: /\.(jpg|png|gif)$/,
94 { test: /\.woff(2)?(\?v=[0-9]\.[0-9]\.[0-9])?$/, use: 'url-loader?limit=10000&minetype=application/font-woff' },
95 { test: /\.(ttf|eot|svg)(\?v=[0-9]\.[0-9]\.[0-9])?$/, use: 'file-loader' }
101 new ExtractTextPlugin({
102 filename: '[name].[hash].css'
105 new PurifyCSSPlugin({
106 paths: [ helpers
.root('src/standalone/videos/embed.ts') ],
109 whitelist: [ '*vjs*', '*video-js*' ]
115 new HtmlWebpackPlugin({
116 template: 'src/standalone/videos/embed.html',
117 filename: 'embed.html',
119 chunksSortMode: 'dependency',
124 * Plugin LoaderOptionsPlugin (experimental)
126 * See: https://gist.github.com/sokra/27b24881210b56bbaff7
128 new LoaderOptionsPlugin({
132 path: helpers
.root('dist')
139 maxEntrypointSize: 600000, // 600kB
149 clearImmediate: false,
155 configuration
.plugins
.push(
173 new HashedModuleIdsPlugin()