惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

I
Intezer
V
Vulnerabilities – Threatpost
Google Online Security Blog
Google Online Security Blog
T
The Exploit Database - CXSecurity.com
C
CXSECURITY Database RSS Feed - CXSecurity.com
AWS News Blog
AWS News Blog
G
GRAHAM CLULEY
P
Privacy & Cybersecurity Law Blog
www.infosecurity-magazine.com
www.infosecurity-magazine.com
C
Cybersecurity and Infrastructure Security Agency CISA
N
News | PayPal Newsroom
T
Tenable Blog
Spread Privacy
Spread Privacy
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
S
Secure Thoughts
P
Privacy International News Feed
IT之家
IT之家
Project Zero
Project Zero
T
The Blog of Author Tim Ferriss
Engineering at Meta
Engineering at Meta
大猫的无限游戏
大猫的无限游戏
博客园_首页
GbyAI
GbyAI
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
量子位
雷峰网
雷峰网
Apple Machine Learning Research
Apple Machine Learning Research
Hacker News: Ask HN
Hacker News: Ask HN
Google DeepMind News
Google DeepMind News
MongoDB | Blog
MongoDB | Blog
N
Netflix TechBlog - Medium
Martin Fowler
Martin Fowler
NISL@THU
NISL@THU
I
InfoQ
D
DataBreaches.Net
有赞技术团队
有赞技术团队
K
Kaspersky official blog
Security Latest
Security Latest
The Register - Security
The Register - Security
Hugging Face - Blog
Hugging Face - Blog
S
Security @ Cisco Blogs
P
Proofpoint News Feed
M
MIT News - Artificial intelligence
H
Hackread – Cybersecurity News, Data Breaches, AI and More
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
AI
AI
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
P
Proofpoint News Feed
Security Archives - TechRepublic
Security Archives - TechRepublic
N
News and Events Feed by Topic

木灵鱼儿

Windows 下如何快速复制目录的同时排除指定的目录和文件 - 木灵鱼儿 x86多网口软路由+pve+爱快ikuai+iStoreOS实现组网和翻墙 - 木灵鱼儿 如何在 Vite 项目中优雅地展示用户协议?(Markdown 转 Vue 组件方案) - 木灵鱼儿 Vue 路由守卫进阶:用策略模式告别 if-else - 木灵鱼儿 16 Python for循环 - 木灵鱼儿 15 Python while循环 - 木灵鱼儿 如何生成一个“扫码连WIFI”的二维码 - 木灵鱼儿 14 Python 分支语句if - 木灵鱼儿 13 Python 字符串详解 - 木灵鱼儿 12 Python 语句、表达式与运算符 - 木灵鱼儿
生产部署时动态导入 Chunk 失效的实用回退方案 - 木灵鱼儿
木灵鱼儿 · 2026-03-16 · via 木灵鱼儿

前言与痛点

在单页应用(SPA)的日常开发与运维中,我们经常会遇到因旧版本文件失效导致的用户访问异常。一个典型的场景如下:

  1. 10:00 —— 部署了版本 V1,用户正常访问并停留在页面 A。
  2. 11:00 —— 部署了版本 V2。此时,服务器上的 JS 文件带有全新的 Hash 后缀,V1 版本的旧 JS 文件已被新版本覆盖或被清理。
  3. 11:05 —— 停留在页面 A 的用户尝试点击路由跳转到页面 B。此时浏览器尝试通过 import() 动态加载页面 B 对应的 chunk 文件,但服务器上该文件已不存在,导致请求返回 404。

此时,基于 ESM 构建的工具(如 Vite)在控制台通常会抛出以下错误,导致前端路由完全卡死,页面毫无反应:

TypeError: Failed to fetch dynamically imported module: https://.../assets/xxxx.abc123.js

在频繁迭代、敏捷部署的业务环境中,如果不妥善处理此类问题,将会导致用户访问失败,严重影响用户体验。

此处内容已隐藏回复后方可阅读。

版权申明

本文系作者 @木灵鱼儿 原创发布在木灵鱼儿站点。未经许可,禁止转载。