做微信推送封面的网站,网站建设捌金手指花总十七,项目设计方案,百度app智能小程序1.每次部署后#xff0c;需要清除缓存#xff0c;才能看到最新代码#xff0c;给打包文件加上hash就可以解决此问题。
vite.config.ts文件中加以下代码 build: {rollupOptions: {output: {entryFileNames: assets/[name].[hash].js,chunkFileNames: assets/[name].[hash].j…1.每次部署后需要清除缓存才能看到最新代码给打包文件加上hash就可以解决此问题。
vite.config.ts文件中加以下代码 build: {rollupOptions: {output: {entryFileNames: assets/[name].[hash].js,chunkFileNames: assets/[name].[hash].js,assetFileNames: assets/[name].[hash].[ext],}},
}
2. 使用Vite打包构建的项目重新部署到生产。在部署期间用户一直停留在当前项目页面长时间无操作 半个小时部署完成后点击页面上的路由报错 刷新后恢复正常。 报错内容为 Failed to fetch dynamically imported module
解决方式如下
router.onError(error {const fetchResourcesErrors [Failed to fetch dynamically imported module, Importing a module script failed]if (fetchResourcesErrors.some((item) error?.message error.message?.includes(item))) {window.location.reload()}});