SimpleNotes/frontend/nuxt.config.js

157 lines
3.7 KiB
JavaScript

export default ({ command }) => ({
mode: 'universal',
/*
** Headers of the page
*/
head: {
titleTemplate: '%s - ' + 'SimpleNotes',
title: 'SimpleNotes' || '',
htmlAttrs: {
lang: 'en',
},
meta: [
{ charset: 'utf-8' },
{
name: 'viewport',
content: 'width=device-width, initial-scale=1',
},
{
hid: 'description',
name: 'description',
content: process.env.npm_package_description || '',
},
],
link: [{ rel: 'icon', type: 'image/x-icon', href: '/favicon.ico' }],
},
/*
** Customize the progress-bar color
*/
loading: { color: '#fff' },
/*
** Global CSS
*/
css: ['~/assets/main.css'],
/*
** Plugins to load before mounting the App
*/
plugins: ['~/plugins/theme.client.js'],
/*
** Nuxt.js dev-modules
*/
buildModules: [
// Doc: https://github.com/nuxt-community/eslint-module
'@nuxtjs/eslint-module',
'@nuxtjs/tailwindcss',
],
/*
** Nuxt.js modules
*/
modules: [
// Doc: https://axios.nuxtjs.org/usage
'@nuxtjs/axios',
// Doc: https://github.com/nuxt-community/dotenv-module
'@nuxtjs/auth',
// Doc: https://github.com/nuxt-community/robots-module
'@nuxtjs/robots',
],
/*
** Axios module configuration
** See https://axios.nuxtjs.org/options
*/
axios: {},
publicRuntimeConfig: {
API_HOST: process.env.API_HOST,
},
auth: {
redirect: {
login: '/account',
logout: '/',
home: '/notes',
},
watchLoggedIn: true,
cookie: !command.includes('generate'),
strategies: {
_scheme: 'local',
_name: 'local',
local: {
endpoints: {
login: {
url: '/user/login',
method: 'post',
propertyName: 'token',
},
user: {
url: '/user/me',
method: 'get',
propertyName: 'user',
},
logout: false,
},
autoFetchUser: true,
},
},
},
router: {
middleware: ['auth'],
},
generate: {
fallback: '404.html',
},
/*
** Build configuration
*/
build: {
extractCSS: false,
terser: {
parallel: true,
cache: false,
sourceMap: false,
extractComments: false,
terserOptions: {},
},
html: {
minify: {
collapseBooleanAttributes: true,
decodeEntities: true,
minifyCSS: true,
minifyJS: true,
processConditionalComments: true,
removeEmptyAttributes: true,
removeRedundantAttributes: true,
trimCustomFragments: true,
useShortDoctype: true,
collapseWhitespace: true,
removeComments: true,
},
},
/*
** You can extend webpack config here
*/
extend(config, ctx) {},
},
components: true,
telemetry: false,
robots: {
UserAgent: '*',
Disallow: '/',
},
render: {
bundleRenderer: {
shouldPrefetch: () => false,
shouldPreload: (_, asType) =>
['font', 'script', 'style'].includes(asType),
},
},
})