Skip to content

Externalize target name configurations #161

@tbinna

Description

@tbinna

Several parts of the plugin code make assumptions about the target names, which may not always be true. In some cases, the plugin provides an override option; in other cases, it does not.

We should probably externalize target name configurations (just like many other Nx plugins), to make the plugin easier to use in different workspace setups. For example, the @nx/webpack/plugin provides these plugin options:

  {
      "plugin": "@nx/webpack/plugin",
      "options": {
        "buildTargetName": "build",
        "serveTargetName": "serve",
        "previewTargetName": "preview",
        "buildDepsTargetName": "build-deps",
        "watchDepsTargetName": "watch-deps"
      }
    }

Nx by default often configures plugin targets prefixed with the tool name, e.g. webpack:build, vite:build, etc.

Known assumptions in our codebase:

Package executor
(override option via resourceOutputPathMap)

Tunnel executor

{ project: config.projectName, target: 'serve' },

Challanges

  • Tunnel executor: If different Custom UIs use different bundlers, e.g., one with webpack and target name webpack:serve and one with vite and vite:serve, then setting the target name at the plugin level won't help. In this case, the user would have to ensure each Custom UI project has a serve target. They could achieve that by configuring a serve target in each project.json and mapping it to the desired executor. In this case, externalizing this may not make sense.

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