mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-30 06:05:30 -05:00
26190da566
Compile CSS using webpack GitOrigin-RevId: 489834038667dde572ea5d9b4b9392b362259a09
31 lines
977 B
JavaScript
31 lines
977 B
JavaScript
const merge = require('webpack-merge')
|
|
const TerserPlugin = require('terser-webpack-plugin')
|
|
const OptimizeCssAssetsPlugin = require('optimize-css-assets-webpack-plugin')
|
|
const MiniCssExtractPlugin = require('mini-css-extract-plugin')
|
|
|
|
const base = require('./webpack.config')
|
|
|
|
module.exports = merge(base, {
|
|
mode: 'production',
|
|
|
|
// Enable a full source map. Generates a comment linking to the source map
|
|
devtool: 'source-map',
|
|
|
|
output: {
|
|
// Override filename to include hash for immutable caching
|
|
filename: 'js/[name]-[chunkhash].js'
|
|
},
|
|
|
|
optimization: {
|
|
// Minify JS (with Terser) and CSS (with cssnano)
|
|
minimizer: [new TerserPlugin(), new OptimizeCssAssetsPlugin()]
|
|
},
|
|
|
|
plugins: [
|
|
// Extract CSS to a separate file (rather than inlining to a <style> tag)
|
|
new MiniCssExtractPlugin({
|
|
// Output to public/stylesheets directory and append hash for immutable caching
|
|
filename: 'stylesheets/[name]-[chunkhash].css'
|
|
})
|
|
]
|
|
})
|