-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathwebpack.prod.js
More file actions
29 lines (25 loc) · 820 Bytes
/
webpack.prod.js
File metadata and controls
29 lines (25 loc) · 820 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
const merge = require('webpack-merge');
const SitemapPlugin = require('sitemap-webpack-plugin').default;
const slugify = require('slugify');
const TerserPlugin = require('terser-webpack-plugin');
const common = require('./webpack.common.js');
const trips = require('./src/trips/trips.json');
const sitemapPaths = ['/'];
trips.forEach(trip => {
sitemapPaths.push(`/${trip.id}/`);
trip.entries.forEach(entry => {
const entrySlug = slugify(entry.title, { lower: true, remove: /[:,]/ });
sitemapPaths.push(`/${trip.id}/${entry.id}-${entrySlug}`);
});
});
module.exports = merge(common, {
mode: 'production',
devtool: 'source-map',
plugins: [
new SitemapPlugin('https://roadtrips.iwazaru.fr', sitemapPaths),
],
optimization: {
minimize: true,
minimizer: [new TerserPlugin()],
},
});