const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin; const webpack = require('webpack'); const PurgecssPlugin = require('purgecss-webpack-plugin') const PreloadWebpackPlugin = require('preload-webpack-plugin'); const glob = require('glob-all') const path = require('path') let plugins = [ // do not include moment.js locales since it's quite heavy new webpack.IgnorePlugin(/^\.\/locale$/, /moment$/), new PreloadWebpackPlugin({ rel: 'preload', include: ['audio', 'core', 'about'] }), ] if (process.env.BUNDLE_ANALYZE === '1') { plugins.push(new BundleAnalyzerPlugin()) } plugins.push( new PurgecssPlugin({ paths: glob.sync([ path.join(__dirname, './public/index.html'), path.join(__dirname, './public/embed.html'), path.join(__dirname, './**/*.vue'), path.join(__dirname, './src/**/*.js') ]), whitelist: ['scale'], whitelistPatterns:[/plyr/], whitelistPatternsChildren:[/plyr/,/dropdown/,/upward/] }), ) module.exports = { baseUrl: process.env.BASE_URL || '/front/', productionSourceMap: false, // Add settings for manifest file pwa: { name: 'Funkwhale', themeColor: '#f2711c', msTileColor: '#000000', appleMobileWebAppCapable: 'yes', appleMobileWebAppStatusBarStyle: 'black', display: 'minimal-ui', workboxPluginMode: 'InjectManifest', manifestOptions: { start_url: '.', description: 'A social platform to enjoy and share music', scope: "/", categories: ["music"], icons: [ { 'src': 'favicon.png', 'sizes': '192x192', 'type': 'image/png' }, { 'src': 'favicon.png', 'sizes': '512x512', 'type': 'image/png' }, ] }, workboxOptions: { importWorkboxFrom: 'local', // swSrc is required in InjectManifest mode. swSrc: 'src/service-worker.js', swDest: 'service-worker.js', }, iconPaths: { favicon32: 'favicon.png', favicon16: 'favicon.png', appleTouchIcon: 'favicon.png', maskIcon: 'favicon.png', msTileImage: 'favicon.png' } }, pages: { embed: { entry: 'src/embed.js', template: 'public/embed.html', filename: 'embed.html', }, index: { entry: 'src/main.js', template: 'public/index.html', filename: 'index.html' } }, chainWebpack: config => { config.plugins.delete('prefetch-embed') config.plugins.delete('prefetch-index') }, configureWebpack: { plugins: plugins, devtool: false }, devServer: { disableHostCheck: true, // use https://node1.funkwhale.test/front-server/ if you use docker with federation public: process.env.FRONT_DEVSERVER_URL || ('http://localhost:' + (process.env.VUE_PORT || '8080')) } }