nuxt 内存溢出
nuxt部署到生产环境后会出现内存溢出的情况,经过压力测试发现每一个请求都会增加内存并且释放不了。
经过多次修改还是解决不了,请问有人遇到这种情况吗?
配置文件:
`
const pkg = require('./package')
module.exports = {
mode: 'universal',
/*
** Headers of the page
*/
head: {
title: '广州市工程造价行业协会材价信息平台',
meta: [
{ charset: 'utf-8' },
{ name: 'viewport', content: 'width=device-width, initial-scale=1' },
{ hid: 'description', name: 'description', content: pkg.description }
],
// script: [
// { src: 'https://hm.baidu.com/hm.js?c91e3eac84ffbb378ebba94cd782deab' }
// ],
link: [{ rel: 'icon', type: 'image/x-icon', href: '/favicon.ico' }]
},
/*
** Customize the progress-bar color
*/
loading: { color: '#409EFF' },
/*
** Global CSS
*/
css: [
'element-ui/lib/theme-chalk/index.css',
'@/assets/style/index.scss',
'quill/dist/quill.snow.css',
'quill/dist/quill.bubble.css',
'quill/dist/quill.core.css'
],
/*
** Plugins to load before mounting the App
*/
plugins: [
'@/plugins/element-ui',
// '@/plugins/request',
'@/plugins/permission',
{ src: '~/plugins/vue-quill-editor.js', mode: 'client' },
{ src: '~/plugins/vue-seamless-scroll.js', mode: 'client' }
// 生产环境添加百度统计
// { src: '~/plugins/baidu.js' }
],
/*
** Nuxt.js modules
*/
modules: [
// Doc: https://axios.nuxtjs.org/usage
'@nuxtjs/axios',
'@nuxtjs/proxy'
],
/*
** Axios module configuration
*/
axios: {
proxy: true
// See https://github.com/nuxt-community/axios-module#options
},
proxy: {
'/api/': {
target: 'http://127.0.0.1:8888',
pathRewrite: {
'^/api': '/',
changeOrigin: true
}
}
},
/*
** Build configuration
*/
build: {
transpile: [/^element-ui/],
/*
** You can extend webpack config here
*/
extend(config, ctx) {
// Run ESLint on save
if (ctx.isDev && ctx.isClient) {
config.module.rules.push({
enforce: 'pre',
test: /\.(js|vue)$/,
loader: 'eslint-loader',
exclude: /(node_modules)/
})
}
}
// ,
// analyze: true
},
router: {
// 页面跳转时滚动条返回顶部
scrollBehavior: function (to, from, savedPosition) {
return { x: 0, y: 0 }
}
}
}
`
入口文件:
<template>
<section :class="$route.path != '/' ? 'f6': ''">
<!-- <nuxt-child /> -->
<!-- 权限弹出框 -->
<dialog-permission />
</section>
</template>
<script>
import dialogPermission from '~/components/eca/dialog-permission'
export default {
layout: 'front',
components: {
dialogPermission
},
async fetch({ store, $axios }) {
if (!store.getters.init) {
const initCallback = await Promise.all([$axios.get('/api/isAuthenticated'), $axios.get('/api/front/printCatelog')])
const userData = initCallback[0].data.data
const listData = initCallback[1].data
const list = listData === undefined ? [] : listData[1].concat(listData[2], listData[3], listData[4])
userData && store.dispatch('userLogin', userData)
store.dispatch('updataMemberState')
store.dispatch('code', list === undefined ? [] : list === null ? [] : list)
store.dispatch('init', true)
}
}
}
</script>
<style lang="scss" scoped>
.f6{
background: #f6f6f6;
padding-bottom: 30px;
}
</style>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论