umami/next.config.js

45 lines
956 B
JavaScript
Raw Normal View History

2020-07-17 10:03:38 +02:00
require('dotenv').config();
const pkg = require('./package.json');
2020-07-17 10:03:38 +02:00
const { BASE_PATH, FORCE_SSL, DISABLE_LOGIN, TRACKER_SCRIPT_NAME } = process.env;
2020-07-17 10:03:38 +02:00
module.exports = {
env: {
VERSION: pkg.version,
FORCE_SSL: Boolean(FORCE_SSL),
DISABLE_LOGIN: Boolean(DISABLE_LOGIN),
TRACKER_SCRIPT_NAME,
2020-09-27 05:46:20 +02:00
},
basePath: BASE_PATH,
2021-11-22 23:53:36 +01:00
eslint: {
ignoreDuringBuilds: true,
},
2020-07-17 10:03:38 +02:00
webpack(config) {
config.module.rules.push({
test: /\.svg$/,
2021-07-13 05:25:24 +02:00
issuer: /\.js$/,
2020-07-17 10:03:38 +02:00
use: ['@svgr/webpack'],
});
return config;
},
async rewrites() {
return TRACKER_SCRIPT_NAME
? [{ source: `/${TRACKER_SCRIPT_NAME}.js`, destination: '/umami.js' }]
: [];
},
async headers() {
return [
{
source: `/${TRACKER_SCRIPT_NAME || 'umami'}.js`,
headers: [
{
key: 'Cache-Control',
value: 'public, max-age=2592000', // 30 days
},
],
},
2020-12-04 07:28:05 +01:00
];
},
2020-07-17 10:03:38 +02:00
};