diff --git a/index.js b/index.js index 6c747d1..bbd130b 100644 --- a/index.js +++ b/index.js @@ -29,7 +29,9 @@ class Smarty { this.reset() this.__CACHE__ = Object.create(null) // 渲染缓存 // 消除缓存目录 - fs.rm(cacheDir) + if (fs.isdir(cacheDir)) { + fs.rm(cacheDir) + } } reset() { diff --git a/index.mjs b/index.mjs index 14e08a4..4865af1 100644 --- a/index.mjs +++ b/index.mjs @@ -31,7 +31,9 @@ export default class Smarty { this.reset() this.__CACHE__ = Object.create(null) // 渲染缓存 // 消除缓存目录 - fs.rm(cacheDir) + if (fs.isdir(cacheDir)) { + fs.rm(cacheDir) + } } reset() { diff --git a/package.json b/package.json index 42250fb..9f55675 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "smartyx", - "version": "2.1.0", + "version": "2.1.1", "description": "nodeJS模板引擎,理念源自于PHP的smarty模板引擎", "keywords": ["fivejs", "php", "smarty", "template", "ejs", "jade"], "author": "yutent ",