Files
orisoxin/nuxt.config.js
T
morteza 4b5447c828
deploy to danak / build_and_deploy (push) Has been cancelled
Fix SSR 500 by proxying API requests to the Nuxt server port.
Point axios proxy at the same process as serverMiddleware instead of an unused port, and allow MongoDB URI to be configured via env.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-03 14:37:32 +03:30

114 lines
2.6 KiB
JavaScript

const webpack = require('webpack');
const nuxtPort = process.env.PORT || 3000
export default {
head: {
title: 'OrisOxin',
meta: [
{ charset: 'utf-8' },
{ name: 'viewport', content: 'width=device-width, initial-scale=1' },
{ hid: 'description', name: 'description', content: '' }
],
link: [
{ rel: 'icon', type: 'image/png', href: '/favicon.png' },
{ rel: 'stylesheet', type: 'text/css', href: '/css/bootstrap-grid.min.css' },
{ rel: 'stylesheet', type: 'text/css', href: '/css/reset-css.css' },
{ rel: 'stylesheet', type: 'text/css', href: '/css/fontawesome/css/all.min.css' },
{ rel: 'stylesheet', type: 'text/css', href: '/js/lightBox/simple-lightbox.min.css' }
],
script: [{ src: '/js/lightBox/simple-lightbox.min.js' }]
},
css: [
'element-ui/lib/theme-chalk/index.css',
'slick-carousel/slick/slick.css',
'slick-carousel/slick/slick-theme.css',
'@/assets/scss/main.scss'
],
plugins: [
'@/plugins/element-ui',
'@/plugins/gsap.client',
'@/plugins/core-ui.client',
'@/plugins/ckEditor.client',
'@/plugins/vueNetworkShare'
],
components: ['~/components/', { path: '~/components/admin/', prefix: '' }],
buildModules: ['@nuxtjs/pwa'],
modules: [
'@nuxtjs/axios',
'@nuxtjs/auth-next'
],
pwa: {
manifest: {
name: 'محاسبه وزن',
short_name: 'orisOxin cal',
description: false,
lang: 'fa',
useWebmanifestExtension: false,
start_url: '/fa/pwa'
},
meta: {
mobileAppIOS: true,
name: 'اریس اکسین'
},
workbox: {
cleanupOutdatedCaches: true
}
},
build: {
transpile: [/^element-ui/],
plugins: [
new webpack.ProvidePlugin({
$: 'jquery',
jQuery: 'jquery',
'window.jQuery': 'jquery'
})
],
splitChunks: {
layouts: true
},
babel: {
plugins: [['@babel/plugin-proposal-private-methods', { loose: true }]]
},
},
axios: {
proxy: true
},
proxy: {
// SSR axios requests must hit the same Nuxt process that hosts serverMiddleware (/api).
'/api': { target: `http://127.0.0.1:${nuxtPort}` }
},
router: {
linkActiveClass: 'active-link',
middleware: ['redirects']
},
serverMiddleware: ['~/server/index.js'],
server: {
host: '0.0.0.0',
port: 3000
},
auth: {
strategies: {
local: {
token: {
property: 'token',
required: true,
type: ''
},
user: {
property: 'user',
autoFetch: true
},
endpoints: {
login: { url: '/api/auth/login', method: 'post' },
logout: { url: '/api/auth/logout', method: 'delete' },
user: { url: '/api/auth/user', method: 'get' }
}
}
},
redirect: false
},
}