Merge pull request #2488 from overleaf/as-import-pr-708

[Imported] Vendor web fonts, (#708)

GitOrigin-RevId: b286a0d4bac9d84f70bf9d4ff99220f67ce67425
This commit is contained in:
Alasdair Smith
2020-01-15 04:20:37 +00:00
committed by Copybot
parent 8a667d3933
commit a084d620ae
48 changed files with 2548 additions and 421 deletions
+23 -1
View File
@@ -5,7 +5,9 @@ const MiniCssExtractPlugin = require('mini-css-extract-plugin')
const base = require('./webpack.config')
module.exports = merge(base, {
// Use "smart" merge: attempts to combine loaders targeting the same file type,
// overriding the base config
module.exports = merge.smart(base, {
mode: 'production',
// Enable a full source map. Generates a comment linking to the source map
@@ -16,6 +18,26 @@ module.exports = merge(base, {
filename: 'js/[name]-[chunkhash].js'
},
module: {
rules: [
{
// Override base font loading to add hash to filename so that we can
// use "immutable" caching
test: /\.(woff|woff2)$/,
use: [
{
loader: 'file-loader',
options: {
outputPath: 'fonts',
publicPath: '/fonts/',
name: '[name]-[hash].[ext]'
}
}
]
}
]
},
optimization: {
// Minify JS (with Terser) and CSS (with cssnano)
minimizer: [new TerserPlugin(), new OptimizeCssAssetsPlugin()]