Generate sitemap

This commit is contained in:
Andras Schmelczer 2022-09-25 16:54:16 +02:00
parent ec804f2319
commit c4324ed6df
No known key found for this signature in database
GPG key ID: 0EA1BC97D0AB076E
3 changed files with 191 additions and 2 deletions

View file

@ -2,8 +2,10 @@ const path = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const TerserPlugin = require('terser-webpack-plugin');
const InlineSourceWebpackPlugin = require('inline-source-webpack-plugin');
const SitemapPlugin = require('sitemap-webpack-plugin').default;
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
const webpack = require('webpack');
const domain = 'schmelczer.dev';
module.exports = (env, argv) => ({
devtool: argv.mode === 'development' ? 'inline-source-map' : false,
@ -26,6 +28,16 @@ module.exports = (env, argv) => ({
maxAssetSize: 512000,
},
plugins: [
new SitemapPlugin({
base: `https://${domain}`,
paths: [
{
path: '/',
priority: 1,
changefreq: 'daily',
},
],
}),
new HtmlWebpackPlugin({
template: './src/index.html',
}),
@ -35,7 +47,7 @@ module.exports = (env, argv) => ({
compress: true,
})
: null,
new webpack.DefinePlugin({
new (require('webpack').DefinePlugin)({
__CURRENT_DATE__: Date.now(),
}),
].filter(Boolean),