audiobookshelf/client/nuxt.config.js

167 lines
4.1 KiB
JavaScript
Raw Normal View History

2021-08-18 00:01:11 +02:00
const pkg = require('./package.json')
module.exports = ({ command }) => ({
2021-08-18 00:01:11 +02:00
// Disable server-side rendering: https://go.nuxtjs.dev/ssr-mode
ssr: false,
target: 'server',
2021-08-18 00:01:11 +02:00
dev: process.env.NODE_ENV !== 'production',
env: {
serverUrl: process.env.NODE_ENV === 'production' ? process.env.ROUTER_BASE_PATH || '' : 'http://localhost:3333',
2022-03-02 00:59:47 +01:00
chromecastReceiver: 'FD1F76C5'
2021-08-18 00:01:11 +02:00
},
telemetry: false,
publicRuntimeConfig: {
version: pkg.version,
routerBasePath: process.env.ROUTER_BASE_PATH || ''
2021-08-18 00:01:11 +02:00
},
// Global page headers: https://go.nuxtjs.dev/config-head
head: {
title: 'Audiobookshelf',
2021-08-18 00:01:11 +02:00
htmlAttrs: {
lang: 'en'
},
meta: [
{ charset: 'utf-8' },
{ name: 'viewport', content: 'width=device-width, initial-scale=1' },
{ hid: 'description', name: 'description', content: '' }
]
},
router: {
// We must specify `./` during build to support dynamic router base paths (https://github.com/nuxt/nuxt/issues/10088)
base: command == 'build' ? './' : process.env.ROUTER_BASE_PATH || ''
},
2021-08-18 00:01:11 +02:00
// Global CSS: https://go.nuxtjs.dev/config-css
css: [
'@/assets/app.css'
],
favicon: '/favicon.ico',
2021-08-18 00:01:11 +02:00
// Plugins to run before rendering page: https://go.nuxtjs.dev/config-plugins
plugins: [
'@/plugins/constants.js',
2021-08-18 00:01:11 +02:00
'@/plugins/init.client.js',
'@/plugins/sortable.js',
'@/plugins/favicon.js',
2021-08-18 00:01:11 +02:00
'@/plugins/axios.js',
'@/plugins/toast.js',
2022-11-07 00:56:44 +01:00
'@/plugins/utils.js',
'@/plugins/i18n.js'
2021-08-18 00:01:11 +02:00
],
// 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/tailwindcss
'@nuxtjs/tailwindcss',
'@nuxtjs/pwa',
'@nuxt/postcss8'
2021-08-18 00:01:11 +02:00
],
// Modules: https://go.nuxtjs.dev/config-modules
modules: [
'nuxt-socket-io',
'@nuxtjs/axios',
'@nuxtjs/proxy',
'@/modules/rewritePwaManifest.js'
2021-08-18 00:01:11 +02:00
],
proxy: {
[`${process.env.ROUTER_BASE_PATH || ''}/dev/`]: {
target: `http://localhost:3333${process.env.ROUTER_BASE_PATH || ''}`,
pathRewrite: { [`^${process.env.ROUTER_BASE_PATH || ''}/dev/`]: process.env.ROUTER_BASE_PATH || '' }
},
[`${process.env.ROUTER_BASE_PATH || ''}/ebook/`]: {
target: (process.env.NODE_ENV !== 'production' ? 'http://localhost:3333' : '') + `${process.env.ROUTER_BASE_PATH || ''}/`
},
[`${process.env.ROUTER_BASE_PATH || ''}/s/`]: {
target: (process.env.NODE_ENV !== 'production' ? 'http://localhost:3333' : '') + `${process.env.ROUTER_BASE_PATH || ''}/`
}
2021-08-18 00:01:11 +02:00
},
io: {
sockets: [{
name: 'dev',
url: 'http://localhost:3333'
},
{
name: 'prod'
}]
},
// Axios module configuration: https://go.nuxtjs.dev/config-axios
axios: {
baseURL: process.env.ROUTER_BASE_PATH || ''
2021-08-18 00:01:11 +02:00
},
2022-02-09 02:09:24 +01:00
// nuxt/pwa https://pwa.nuxtjs.org
pwa: {
2022-02-09 15:57:34 +01:00
icon: false,
2022-02-09 02:09:24 +01:00
meta: {
2022-02-09 15:57:34 +01:00
appleStatusBarStyle: 'black',
2022-02-09 02:09:24 +01:00
name: 'Audiobookshelf',
2022-02-09 15:57:34 +01:00
theme_color: '#373838',
mobileAppIOS: true,
nativeUI: true
2022-02-09 02:09:24 +01:00
},
manifest: {
publicPath: `${(process.env.ROUTER_BASE_PATH || '')}_nuxt`,
2022-02-09 02:09:24 +01:00
name: 'Audiobookshelf',
short_name: 'Audiobookshelf',
2022-02-09 15:57:34 +01:00
display: 'standalone',
background_color: '#373838',
icons: [
{
src: '/icon.svg',
2022-11-12 17:03:41 +01:00
sizes: "any"
},
{
src: '/icon64.png',
type: "image/png",
sizes: "64x64"
2022-02-09 15:57:34 +01:00
}
]
},
workbox: {
2022-12-02 00:26:22 +01:00
offline: false,
cacheAssets: false,
2022-11-20 00:57:26 +01:00
preCaching: [],
runtimeCaching: []
2022-02-09 15:57:34 +01:00
}
2022-02-09 02:09:24 +01:00
},
2021-08-18 00:01:11 +02:00
// Build Configuration: https://go.nuxtjs.dev/config-build
build: {
postcss: {
plugins: {
tailwindcss: {},
autoprefixer: {},
},
}
},
2021-08-18 00:01:11 +02:00
watchers: {
webpack: {
aggregateTimeout: 300,
poll: 1000
}
},
server: {
port: process.env.CLIENT_PORT || 3000,
host: '0.0.0.0'
},
/**
* Temporary workaround for @nuxt-community/tailwindcss-module.
*
* Reported: 2022-05-23
* See: [Issue tracker](https://github.com/nuxt-community/tailwindcss-module/issues/480)
*/
devServerHandlers: [],
})