2023-02-15 10:27:18 +00:00
|
|
|
/* eslint-disable @typescript-eslint/no-var-requires */
|
2020-07-17 08:03:38 +00:00
|
|
|
require('dotenv').config();
|
2020-09-09 23:12:29 +00:00
|
|
|
const pkg = require('./package.json');
|
2020-07-17 08:03:38 +00:00
|
|
|
|
2022-08-01 06:29:47 +00:00
|
|
|
const contentSecurityPolicy = `
|
|
|
|
|
default-src 'self';
|
|
|
|
|
img-src *;
|
|
|
|
|
script-src 'self' 'unsafe-eval';
|
|
|
|
|
style-src 'self' 'unsafe-inline';
|
|
|
|
|
connect-src 'self' api.umami.is;
|
|
|
|
|
frame-ancestors 'self';
|
|
|
|
|
`;
|
|
|
|
|
|
|
|
|
|
const headers = [
|
|
|
|
|
{
|
|
|
|
|
key: 'X-DNS-Prefetch-Control',
|
|
|
|
|
value: 'on',
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
key: 'X-Frame-Options',
|
|
|
|
|
value: 'SAMEORIGIN',
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
key: 'Content-Security-Policy',
|
|
|
|
|
value: contentSecurityPolicy.replace(/\s{2,}/g, ' ').trim(),
|
|
|
|
|
},
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
if (process.env.FORCE_SSL) {
|
|
|
|
|
headers.push({
|
|
|
|
|
key: 'Strict-Transport-Security',
|
|
|
|
|
value: 'max-age=63072000; includeSubDomains; preload',
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
2020-07-17 08:03:38 +00:00
|
|
|
module.exports = {
|
2020-09-09 23:12:29 +00:00
|
|
|
env: {
|
2022-06-24 08:54:55 +00:00
|
|
|
currentVersion: pkg.version,
|
2022-08-09 17:27:35 +00:00
|
|
|
isProduction: process.env.NODE_ENV === 'production',
|
2022-10-28 00:02:54 +00:00
|
|
|
uiDisabled: !!process.env.DISABLE_UI,
|
2020-09-27 03:46:20 +00:00
|
|
|
},
|
2022-02-19 05:30:41 +00:00
|
|
|
basePath: process.env.BASE_PATH,
|
2022-07-07 16:24:32 +00:00
|
|
|
output: 'standalone',
|
2021-11-22 22:53:36 +00:00
|
|
|
eslint: {
|
|
|
|
|
ignoreDuringBuilds: true,
|
|
|
|
|
},
|
2022-12-13 03:45:38 +00:00
|
|
|
typescript: {
|
|
|
|
|
ignoreBuildErrors: true,
|
|
|
|
|
},
|
2020-07-17 08:03:38 +00:00
|
|
|
webpack(config) {
|
|
|
|
|
config.module.rules.push({
|
|
|
|
|
test: /\.svg$/,
|
2022-12-13 03:45:38 +00:00
|
|
|
issuer: /\.{js|jsx|ts|tsx}$/,
|
2020-07-17 08:03:38 +00:00
|
|
|
use: ['@svgr/webpack'],
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
return config;
|
|
|
|
|
},
|
2020-10-05 07:45:24 +00:00
|
|
|
async headers() {
|
|
|
|
|
return [
|
2022-08-01 06:29:47 +00:00
|
|
|
{
|
|
|
|
|
source: '/:path*',
|
|
|
|
|
headers,
|
|
|
|
|
},
|
2022-08-02 07:24:17 +00:00
|
|
|
];
|
|
|
|
|
},
|
|
|
|
|
async rewrites() {
|
|
|
|
|
return [
|
2020-10-05 07:45:24 +00:00
|
|
|
{
|
2022-08-02 07:24:17 +00:00
|
|
|
source: '/telemetry.js',
|
|
|
|
|
destination: '/api/scripts/telemetry',
|
2020-10-05 07:45:24 +00:00
|
|
|
},
|
2020-12-04 06:28:05 +00:00
|
|
|
];
|
2020-10-05 07:45:24 +00:00
|
|
|
},
|
2020-07-17 08:03:38 +00:00
|
|
|
};
|