diff --git a/docs/dev-guide/generator-api.md b/docs/dev-guide/generator-api.md index 886cfb1d35..e66417e0d8 100644 --- a/docs/dev-guide/generator-api.md +++ b/docs/dev-guide/generator-api.md @@ -44,10 +44,10 @@ The version string for the **project local** `@vue/cli-service` version that is ## resolve - **Arguments** - - `{string} _path` - relative path from project root + - `{string} ..._paths` - A sequence of relative paths or path segments - **Returns** - - `{string}`- the resolved absolute path + - `{string}`- the resolved absolute path, caculated based on the current project root - **Usage**: Resolve a path for the current project diff --git a/packages/@vue/cli/lib/GeneratorAPI.js b/packages/@vue/cli/lib/GeneratorAPI.js index 0dc7ed43b4..6ae208720d 100644 --- a/packages/@vue/cli/lib/GeneratorAPI.js +++ b/packages/@vue/cli/lib/GeneratorAPI.js @@ -68,11 +68,11 @@ class GeneratorAPI { /** * Resolve path for a project. * - * @param {string} _path - Relative path from project root - * @return {string} The resolved absolute path. + * @param {string} _paths - A sequence of relative paths or path segments + * @return {string} The resolved absolute path, caculated based on the current project root. */ - resolve (_path) { - return path.resolve(this.generator.context, _path) + resolve (..._paths) { + return path.resolve(this.generator.context, ..._paths) } get cliVersion () {