记录一次vue项目本地打包部署过程

记录一次本地打包vue项目遇见的问题
内存溢出

FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory
-  Building for production... 1: 00007FF663BB4C9F napi_wrap+111007
 2: 00007FF663B58226 v8::base::CPU::has_sse+59910
 3: 00007FF663B59126 node::OnFatalError+294
 4: 00007FF664432ABE v8::Isolate::ReportExternalAllocationLimitReached+94
 5: 00007FF66441788D v8::SharedArrayBuffer::Externalize+781
 6: 00007FF6642C09DC v8::internal::Heap::EphemeronKeyWriteBarrierFromCode+1516
 7: 00007FF6642BBDD1 v8::internal::Heap::AllocateExternalBackingStore+1601
 8: 00007FF6642D5B65 v8::internal::GCIdleTimeHandler::ShouldDoContextDisposalMarkCompact+1029
 9: 00007FF6642D5FB5 v8::internal::Factory::AllocateRaw+37
10: 00007FF6642E9AF6 v8::internal::FactoryBase<v8::internal::Factory>::NewFixedArrayWithFiller+86
11: 00007FF6642E9E03 v8::internal::FactoryBase<v8::internal::Factory>::NewFixedArrayWithMap+35
12: 00007FF6640F07DC v8::internal::OrderedHashTable<v8::internal::OrderedHashSet,1>::Allocate+124
13: 00007FF6640F329A v8::internal::OrderedHashTable<v8::internal::OrderedHashSet,1>::Rehash+58
14: 00007FF6640F1D3A v8::internal::OrderedHashTable<v8::internal::OrderedHashSet,1>::EnsureGrowable+90
15: 00007FF6640288D7 v8::internal::interpreter::JumpTableTargetOffsets::iterator::operator=+123479
16: 00007FF6644BB97D v8::internal::SetupIsolateDelegate::SetupHeap+465325
17: 00007FF6644A449D v8::internal::SetupIsolateDelegate::SetupHeap+369869
18: 000000E4C77AA3F5

解决办法

``
“build:prod”: "vue-cli-service build ",

// 修改为

“build:prod”: “node --max_old_space_size=4096 node_modules/@vue/cli-service/bin/vue-cli-service.js build --mode production”,
``

nginx配置

    server {
            listen       9528;
            server_name  localhost;

            #charset koi8-r;

            #access_log  logs/host.access.log  main;
            root D:/demo_pro_vue/dist/;
            location / {
                try_files $uri $uri/ /index.html;
            }

            location /abc {
                proxy_pass  http://192.168.51.150:8082/;
            }
                        
            location /def {
                proxy_pass  http://192.168.51.150:8282/;
            }
            #error_page  404              /404.html;

            # redirect server error pages to the static page /50x.html
            #
            error_page   500 502 503 504  /50x.html;
            location = /50x.html {
                root   D:/demo_pro_vue/html/;
            }
           
        
        }

nginx location 路径匹配问题

location /abc
proxy_pass http://192.168.51.150:8082/

location 路径前带着/ 后面不带 模糊匹配 /abc 可以匹配到 /abcdfds/
前后都带着/ /abc 可以只能匹配到 /abc/

proxy_pass 后面不带 / 则不会将匹配到的location 进行替换
proxy_pass 后面带 / 则会将匹配到的location 进行替换 替换方式为 / 后面的内容 如果没有则替换为空
location /abc
proxy_pass http://192.168.51.150:8082/xxx
abc 会被替换成xxx

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值