Skip to content

package.json webExt section doesn't support global options for commands #3571

@xM8WVqaG

Description

@xM8WVqaG

What is the current behavior?

There is a set of global options (these ones) which can be set on any (?) specific command as an arg.

For example:

  • web-ext run --source-dir dist
  • web-ext lint --ignoreFiles 'dist/**'

This is very useful if you have a compilation step before the extension can be built, so you cannot set source or ignore globally for every command.

However, while they work as arguments, you cannot configure them in the webExt block of package.json.

The following code does not work:

{
  "webExt": {
    "run": {
      "sourceDir": "dist"
    },
    "lint": {
      "ignoreFiles": [
        "dist/**"
      ]
    }
  }
}

When running a command the error is:

UsageError: The config file at /REDACTED/package.json specified an unknown option: "sourceDir"

or

UsageError: The config file at /REDACTED/package.json specified an unknown option: "ignoreFiles"

What is the expected or desired behavior?

It would be useful to be able to set these global options on specific commands, rather than only being able to set them for the entire project.

The current workaround is to spread config between the webExt block and aliasing commands with the correct args as scripts which works but can make debugging tricky as config is now being set in multiple places.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions