X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=client%2Fwebpack%2Fwebpack.video-embed.js;h=d578443fe925174bfe7e7b4bd6e1c914d66f61e6;hb=025ecbf2d8bbf4f47656f05f50458ac65bd41860;hp=12ab6a639c40a93df09af7ef79f6e06c0da2098a;hpb=ae04a0ce1298ca4db8b2d0d69df36845213e5fcb;p=github%2FChocobozzz%2FPeerTube.git diff --git a/client/webpack/webpack.video-embed.js b/client/webpack/webpack.video-embed.js index 12ab6a639..d578443fe 100644 --- a/client/webpack/webpack.video-embed.js +++ b/client/webpack/webpack.video-embed.js @@ -1,12 +1,10 @@ const helpers = require('./helpers') const path = require('path') -const CheckerPlugin = require('awesome-typescript-loader').CheckerPlugin const HtmlWebpackPlugin = require('html-webpack-plugin') const TerserPlugin = require('terser-webpack-plugin') const LoaderOptionsPlugin = require('webpack/lib/LoaderOptionsPlugin') -const ExtractTextPlugin = require('extract-text-webpack-plugin') -const PurifyCSSPlugin = require('purifycss-webpack') +const MiniCssExtractPlugin = require('mini-css-extract-plugin') module.exports = function () { const configuration = { @@ -27,19 +25,26 @@ module.exports = function () { modules: [ helpers.root('src'), helpers.root('node_modules') ], alias: { - 'video.js$': path.resolve('node_modules/video.js/dist/alt/video.core.js') + 'video.js$': path.resolve('node_modules/video.js/core.js'), + '@root-helpers': path.resolve('src/root-helpers'), + '@shared/models': path.resolve('../shared/models'), + '@shared/core-utils': path.resolve('../shared/core-utils') } }, output: { path: helpers.root('dist/standalone/videos'), - filename: '[name].[hash].bundle.js', + + filename: process.env.ANALYZE_BUNDLE === 'true' + ? '[name].bundle.js' + : '[name].[hash].bundle.js', + sourceMapFilename: '[file].map', - chunkFilename: '[id].chunk.js', + chunkFilename: '[id].[hash].chunk.js', publicPath: '/client/standalone/videos/' }, - // devtool: 'source-map', + devtool: process.env.NODE_ENV === 'production' ? false : 'source-map', module: { @@ -48,44 +53,39 @@ module.exports = function () { test: /\.ts$/, use: [ { - loader: 'awesome-typescript-loader', + loader: 'ts-loader', options: { - configFileName: 'tsconfig.json' + configFile: 'tsconfig.base.json' } } - ], - exclude: [/\.(spec|e2e)\.ts$/] + ] }, { test: /\.(sass|scss)$/, - use: ExtractTextPlugin.extract({ - fallback: 'style-loader', - use: [ - { - loader: 'css-loader', - options: { - sourceMap: true, - importLoaders: 1 - } - }, - // { - // loader: 'resolve-url-loader', - // options: { - // debug: true - // } - // }, - { - loader: 'sass-loader', - options: { + use: [ + MiniCssExtractPlugin.loader, + + { + loader: 'css-loader', + options: { + sourceMap: true, + importLoaders: 1 + } + }, + + { + loader: 'sass-loader', + options: { + sassOptions: { sourceMap: true, includePaths: [ helpers.root('src/sass/include') ] } } - ] - }) + } + ] }, { @@ -110,37 +110,34 @@ module.exports = function () { }, plugins: [ - new ExtractTextPlugin({ - filename: '[name].[hash].css' + new MiniCssExtractPlugin({ + filename: process.env.ANALYZE_BUNDLE === 'true' + ? '[name].css' + : '[name].[hash].css' }), - new PurifyCSSPlugin({ - paths: [ - helpers.root('src/standalone/videos/embed.ts'), - helpers.root('src/standalone/videos/test-embed.html') - ], - purifyOptions: { - minify: true, - whitelist: [ '*vjs*', '*video-js*' ] - } - }), - - new CheckerPlugin(), - new HtmlWebpackPlugin({ template: 'src/standalone/videos/embed.html', filename: 'embed.html', title: 'PeerTube', - chunksSortMode: 'dependency', + chunksSortMode: 'auto', inject: 'body', - chunks: ['video-embed'] + chunks: ['video-embed'], + minify: { + collapseWhitespace: true, + removeComments: false, + removeRedundantAttributes: true, + removeScriptTypeAttributes: true, + removeStyleLinkTypeAttributes: true, + useShortDoctype: true + } }), new HtmlWebpackPlugin({ template: '!!html-loader!src/standalone/videos/test-embed.html', filename: 'test-embed.html', title: 'PeerTube', - chunksSortMode: 'dependency', + chunksSortMode: 'auto', inject: 'body', chunks: ['test-embed'] }),