Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.0k views
in Technique[技术] by (71.8m points)

nuxt.js - Is there a way to identify error requests in nuxtServerInit?

I have a scenario where my nuxtServerInit is firing multiple times. Two additional requests to be exact.

This issue is exactly what I am experiencing (on an asset exception nuxt is trigging a new request for the error page): https://stackoverflow.com/a/58367668/1949561

Note, I'm not being redirected in the error page, the error is suppressed, I assume since it was simply a request for a font from the scss.

Specifically from two requests from the scss to import fonts from googleapis:

@import url('https://fonts.googleapis.com/css2?family=Red+Hat+Display:ital,wght@0,400;0,500;0,700;0,900;1,400;1,500;1,700;1,900&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Red+Hat+Text:ital,wght@0,400;0,500;0,700;1,400;1,500;1,700&display=swap');

Before I fix the root cause, I would like to skip the code that is being executed in the nuxtServerInit for these two "error requests".

However, I can't find any way to identify these two requests as "error requests".

Is there a way to identify in the nuxtServerInit requests that were triggered from an error?

Thanks!

question from:https://stackoverflow.com/questions/66056138/is-there-a-way-to-identify-error-requests-in-nuxtserverinit

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

2.1m questions

2.1m answers

60 comments

57.0k users

...