refactor(ui): changed frontend to normal i18n without SSR

This commit is contained in:
akhilmhdh
2023-05-09 23:28:23 +05:30
parent 420d71d923
commit 3561c589b1
198 changed files with 5008 additions and 5253 deletions
+32 -32
View File
@@ -1,10 +1,8 @@
// @ts-check
/**
* @type {import('next').NextConfig}
**/
const { i18n } = require("./next-i18next.config.js");
const path = require('path');
const ContentSecurityPolicy = `
@@ -23,62 +21,67 @@ const ContentSecurityPolicy = `
// after learning more below.
const securityHeaders = [
{
key: "X-DNS-Prefetch-Control",
value: "on",
key: 'X-DNS-Prefetch-Control',
value: 'on'
},
{
key: "Strict-Transport-Security",
value: "max-age=63072000; includeSubDomains; preload",
key: 'Strict-Transport-Security',
value: 'max-age=63072000; includeSubDomains; preload'
},
{
key: "X-XSS-Protection",
value: "1; mode=block",
key: 'X-XSS-Protection',
value: '1; mode=block'
},
{
key: "X-Frame-Options",
value: "SAMEORIGIN",
key: 'X-Frame-Options',
value: 'SAMEORIGIN'
},
{
key: "Permissions-Policy",
value: "camera=(), microphone=()",
key: 'Permissions-Policy',
value: 'camera=(), microphone=()'
},
{
key: "X-Content-Type-Options",
value: "nosniff",
key: 'X-Content-Type-Options',
value: 'nosniff'
},
{
key: "Referrer-Policy",
value: "strict-origin-when-cross-origin",
key: 'Referrer-Policy',
value: 'strict-origin-when-cross-origin'
},
{
key: "Content-Security-Policy",
value: ContentSecurityPolicy.replace(/\s{2,}/g, " ").trim(),
},
key: 'Content-Security-Policy',
value: ContentSecurityPolicy.replace(/\s{2,}/g, ' ').trim()
}
];
module.exports = {
output: "standalone",
output: 'standalone',
i18n: {
locales: ['en', 'ko', 'fr', 'pt-BR', 'pt-PT', 'es'],
defaultLocale: 'en'
},
async headers() {
return [
{
// Apply these headers to all routes in your application.
source: "/:path*",
headers: securityHeaders,
},
source: '/:path*',
headers: securityHeaders
}
];
},
webpack: (config, { isServer, webpack }) => { // config
webpack: (config, { isServer, webpack }) => {
// config
config.module.rules.push({
test: /\.wasm$/,
loader: "base64-loader",
type: "javascript/auto",
loader: 'base64-loader',
type: 'javascript/auto'
});
config.module.noParse = /\.wasm$/;
config.module.rules.forEach((rule) => {
(rule.oneOf || []).forEach((oneOf) => {
if (oneOf.loader && oneOf.loader.indexOf("file-loader") >= 0) {
if (oneOf.loader && oneOf.loader.indexOf('file-loader') >= 0) {
oneOf.exclude.push(/\.wasm$/);
}
});
@@ -89,12 +92,9 @@ module.exports = {
}
// Perform customizations to webpack config
config.plugins.push(
new webpack.IgnorePlugin({ resourceRegExp: /\/__tests__\// })
);
config.plugins.push(new webpack.IgnorePlugin({ resourceRegExp: /\/__tests__\// }));
// Important: return the modified config
return config;
},
i18n,
}
};