Skip to content

Commit

Permalink
fix: useCdn add delete cache confidition
Browse files Browse the repository at this point in the history
  • Loading branch information
zhangyuang committed Apr 7, 2020
1 parent c03e1c9 commit ecb81c2
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
2 changes: 1 addition & 1 deletion packages/ykfe-utils/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ykfe-utils",
"version": "3.6.4",
"version": "3.6.5",
"description": "utils for ykfe",
"main": "lib/index.js",
"module": "es/index.js",
Expand Down
11 changes: 6 additions & 5 deletions packages/ykfe-utils/src/useCdn.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,16 @@ const useCdn = async (serverJs: string, isLocal: boolean, filename: string): Pro
const serverJsPath: string = resolveDir(`./.serverBundle/${filename}.js`)
let SEVER_JS

delete require.cache[serverJsPath]
if (isLocal) {
delete require.cache[serverJsPath]
}

try {
fs.statSync(serverJsPath)
if (fs.existsSync(serverJsPath)) {
if (isLocal) {
// 本地开发环境每次都从cdn拉取文件
// 本地开发环境每次都从cdn拉取文件
SEVER_JS = await getServerBundle(serverJs, serverJsPath)
}
} catch (error) {
} else {
// 首次访问本地没有对应的serverJsPath的情况需要从cdn拉取文件
SEVER_JS = await getServerBundle(serverJs, serverJsPath)
}
Expand Down

0 comments on commit ecb81c2

Please sign in to comment.