Created
January 20, 2021 04:31
-
-
Save alfaben12/b5b97c2bc30d3315d12ed879bfa1eb4a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import axios from 'axios' | |
export default { | |
target: 'server', | |
ssr: true, | |
mode: 'universal', | |
// Global page headers (https://go.nuxtjs.dev/config-head) | |
head: { | |
title: 'FindFitFun - Find The Custom Box', | |
meta: [ | |
{ charset: 'utf-8' }, | |
{ name: 'viewport', content: 'width=device-width, initial-scale=1' }, | |
{ hid: 'robots', name: 'robots', content: 'noindex' }, | |
], | |
link: [ | |
{ | |
rel: 'icon', | |
type: 'image/png', | |
sizes: '144x144', | |
href: '/favicon.png', | |
}, | |
], | |
}, | |
// Global CSS (https://go.nuxtjs.dev/config-css) | |
css: ['~/assets/style'], | |
// Plugins to run before rendering page (https://go.nuxtjs.dev/config-plugins) | |
plugins: [ | |
{ src: '~/plugins/currency', ssr: true }, | |
{ src: '~/plugins/auth' }, | |
{ src: '~/plugins/error_handling' }, | |
{ src: '~/plugins/storage', ssr: true }, | |
{ src: '~/plugins/product' }, | |
{ src: '~/plugins/axios' }, | |
{ src: '~/plugins/sw.client' }, | |
{ src: '~/plugins/qr', mode: 'client' }, | |
{ src: '~/plugins/typed' }, | |
{ src: '~/plugins/clipboard' }, | |
{ src: '~/plugins/html2canvas', mode: 'client' }, | |
{ src: '~/plugins/htmlToText' }, | |
], | |
// Auto import components (https://go.nuxtjs.dev/config-components) | |
components: true, | |
// Modules for dev and build (recommended) (https://go.nuxtjs.dev/config-modules) | |
buildModules: [ | |
// https://go.nuxtjs.dev/eslint | |
'@nuxtjs/eslint-module', | |
// https://go.nuxtjs.dev/stylelint | |
'@nuxtjs/stylelint-module', | |
'@nuxtjs/moment', | |
'@nuxtjs/sitemap', | |
'@nuxtjs/pwa', | |
], | |
// Modules (https://go.nuxtjs.dev/config-modules) | |
modules: [ | |
// https://go.nuxtjs.dev/axios | |
'@nuxtjs/axios', | |
'cookie-universal-nuxt', | |
'@nuxtjs/toast', | |
'@nuxtjs/robots', | |
], | |
// Axios module configuration (https://go.nuxtjs.dev/config-axios) | |
axios: { | |
baseURL: process.env.API_ENDPOINT, | |
// proxy: true | |
}, | |
// Build Configuration (https://go.nuxtjs.dev/config-build) | |
build: { | |
extend(config, { isDev, isClient }) { | |
if (isClient) { | |
config.optimization.splitChunks.maxSize = 200000 | |
config.devtool = 'source-map' | |
} | |
// Sets webpack's mode to development if `isDev` is true. | |
if (isDev) { | |
config.mode = 'development' | |
} | |
}, | |
}, | |
moment: { | |
defaultLocale: 'id', | |
locales: ['id'], | |
timezone: true, | |
defaultTimezone: 'Asia/Jakarta', | |
}, | |
router: { middleware: ['auth'] }, | |
toast: { | |
position: 'top-center', | |
duration: 5000, | |
keepOnHover: true, | |
theme: 'toasted-primary', | |
}, | |
googleAnalytics: { | |
id: process.env.GOOGLE_ANALYTICS_ID, | |
dev: false, | |
}, | |
robots: [ | |
{ | |
Sitemap: `${process.env.APP_URL}/sitemap.xml`, | |
}, | |
{ | |
Sitemap: `${process.env.APP_URL}/sitemap-support.xml`, | |
}, | |
{ | |
Sitemap: `${process.env.APP_URL}/sitemap-product.xml`, | |
}, | |
{ | |
Sitemap: `${process.env.APP_URL}/sitemap-general.xml`, | |
}, | |
{ | |
Sitemap: `${process.env.APP_URL}/sitemap-categories.xml`, | |
}, | |
], | |
sitemap: { | |
path: '/sitemap.xml', | |
hostname: process.env.APP_URL, | |
sitemaps: [ | |
{ | |
path: '/sitemap-general.xml', | |
routes: [ | |
{ | |
url: '/', | |
changefreq: 'daily', | |
priority: 1, | |
lastmodISO: new Date(), | |
}, | |
{ | |
url: '/signin', | |
changefreq: 'daily', | |
priority: 1, | |
lastmodISO: new Date(), | |
}, | |
{ | |
url: '/signup', | |
changefreq: 'daily', | |
priority: 1, | |
lastmodISO: new Date(), | |
}, | |
{ | |
url: '/intro', | |
changefreq: 'daily', | |
priority: 1, | |
lastmodISO: new Date(), | |
}, | |
{ | |
url: '/privacy', | |
changefreq: 'daily', | |
priority: 1, | |
lastmodISO: new Date(), | |
}, | |
{ | |
url: '/settings', | |
changefreq: 'daily', | |
priority: 1, | |
lastmodISO: new Date(), | |
}, | |
{ | |
url: '/search', | |
changefreq: 'daily', | |
priority: 1, | |
lastmodISO: new Date(), | |
}, | |
], | |
}, | |
{ | |
path: '/sitemap-categories.xml', | |
routes: ['/products/boxes', '/products/packages', '/products'], | |
}, | |
{ | |
path: '/sitemap-product.xml', | |
routes: async () => { | |
const { data } = await axios.get( | |
'https://api.findfitfun.com/v1/sitemaps/products' | |
) | |
return data.map((slug) => ({ | |
url: `/products/${slug}`, | |
changefreq: 'weekly', | |
priority: 1, | |
lastmodISO: new Date(), | |
})) | |
}, | |
}, | |
{ | |
path: '/sitemap-support.xml', | |
routes: async () => { | |
const { data } = await axios.get( | |
'https://api.findfitfun.com/v1/sitemaps/supports' | |
) | |
return data.map((slug) => ({ | |
url: `/supports/${slug}`, | |
changefreq: 'weekly', | |
priority: 1, | |
lastmodISO: new Date(), | |
})) | |
}, | |
}, | |
], | |
}, | |
pwa: { | |
meta: { | |
title: 'FindFitFun', | |
author: 'FindFitFun Labs', | |
}, | |
manifest: { | |
name: 'FindFitFun - Find The Custom Box', | |
short_name: 'FindFitFun', | |
lang: 'en', | |
start_url: '/', | |
theme_color: '#4285F4', | |
}, | |
workbox: { | |
cachingExtensions: '~/plugins/workbox-sync.js', | |
enabled: true, | |
runtimeCaching: [ | |
{ | |
urlPattern: process.env.API_ENDPOINT, | |
handler: 'NetworkFirst', | |
method: 'GET', | |
strategyOptions: { | |
cacheName: 'api-cache', | |
}, | |
}, | |
], | |
}, | |
}, | |
server: { | |
port: 3000, | |
}, | |
watchers: { | |
webpack: { | |
ignored: /node_modules/, | |
}, | |
}, | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment