diff --git a/lib/commands/pack.js b/lib/commands/pack.js index 60d98a5..2c5f440 100644 --- a/lib/commands/pack.js +++ b/lib/commands/pack.js @@ -327,8 +327,11 @@ exports.run = function (options) { var sourceMapPath = sysPath.join(this.cwd, typeof this.sourceMap === 'string' ? this.sourceMap : '.source-map'); var outputPath = config.output.path; - fs.ensureDirSync(sourceMapPath); - UtilFs.deleteFolderRecursive(sourceMapPath); + if (fs.existsSync(sourceMapPath)) { + UtilFs.deleteFolderRecursive(sourceMapPath, true); + } else { + fs.ensureDirSync(sourceMapPath); + } recursiveMove(outputPath, sourceMapPath); function recursiveMove(assetPath, distPath) { diff --git a/package.json b/package.json index 8886dea..75304e1 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ykit", - "version": "2.3.0-rc.0", + "version": "2.3.0-rc.1", "description": "现代 JavaScript 应用构建工具", "bin": { "ykit": "bin/ykit" diff --git a/src/commands/pack.js b/src/commands/pack.js index dc5efc1..5acb4ab 100644 --- a/src/commands/pack.js +++ b/src/commands/pack.js @@ -284,8 +284,11 @@ exports.run = function(options) { ); const outputPath = config.output.path; - fs.ensureDirSync(sourceMapPath); - UtilFs.deleteFolderRecursive(sourceMapPath); + if (fs.existsSync(sourceMapPath)) { + UtilFs.deleteFolderRecursive(sourceMapPath, true); + } else { + fs.ensureDirSync(sourceMapPath); + } recursiveMove(outputPath, sourceMapPath); function recursiveMove(assetPath, distPath) {