Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 18 additions & 3 deletions config/webpack/webpack.common.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const HtmlWebpackPlugin = require('html-webpack-plugin');
const CopyPlugin = require('copy-webpack-plugin');
const dotenv = require('dotenv');
const {BundleAnalyzerPlugin} = require('webpack-bundle-analyzer');
const FontPreloadPlugin = require('webpack-font-preload-plugin');
const PreloadWebpackPlugin = require('@vue/preload-webpack-plugin');
const CustomVersionFilePlugin = require('./CustomVersionFilePlugin');

const includeModules = [
Expand Down Expand Up @@ -70,8 +70,17 @@ const webpackConfig = ({envFile = '.env', platform = 'web'}) => ({
isProduction: envFile === '.env.production',
isStaging: envFile === '.env.staging',
}),
new FontPreloadPlugin({
extensions: ['woff2'],
new PreloadWebpackPlugin({
rel: 'preload',
as: 'font',
fileWhitelist: [/\.woff2$/],
include: 'allAssets',
}),
new PreloadWebpackPlugin({
rel: 'prefetch',
as: 'fetch',
fileWhitelist: [/\.lottie$/],
include: 'allAssets',
}),
new ProvidePlugin({
process: 'process/browser',
Expand Down Expand Up @@ -234,6 +243,12 @@ const webpackConfig = ({envFile = '.env', platform = 'web'}) => ({
runtimeChunk: 'single',
splitChunks: {
cacheGroups: {
// We have to load the whole lottie player to get the player to work in offline mode
lottiePlayer: {
test: /[\\/]node_modules[\\/](@dotlottie\/react-player)[\\/]/,
name: 'lottiePlayer',
chunks: 'all',
},
// Extract all 3rd party dependencies (~75% of App) to separate js file
// This gives a more efficient caching - 3rd party deps don't change as often as main source
// When dependencies don't change webpack would produce the same js file (and content hash)
Expand Down
Loading