Skip to content

--config does not take absolute path #583

Closed
tobybellwood/govstrap
#4
@xkxx

Description

@xkxx

Hello,

Currently --config does not take absolute paths. For example, doing something like this throws an error:

> browser-sync start --config /etc/bs-config.js

module.js:318
    throw err;
    ^
Error: Cannot find module '/path/to/cwd/etc/bs-config.js'

This is caused by browser-sync/lib/cli/cli-info.js:28:

        return require(path.resolve(process.cwd() + "/" + filePath));

Which tries to resolve relative url by prepending process.cwd(), but that's the job of path.resolve.
Changing this line to the following does the correct thing, and fixes the issue:

        return require(path.resolve(process.cwd(), filePath));

Thanks,

Kexiang

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions