Skip to content

Latest commit

 

History

History
80 lines (59 loc) · 2.99 KB

README.md

File metadata and controls

80 lines (59 loc) · 2.99 KB

NPM downloads per week NPM version Nx peer dependency version @web/dev-server peer dependency version

nx-plus-web-dev-server

Nx plugin to infer Web Dev Server in a workspace.

Note that @web/dev-server has not released a 1.0.0 yet.

🚀 Getting started

npm i -D @robby-rabbitman/nx-plus-web-dev-server
nx g @robby-rabbitman/nx-plus-web-dev-server:init

Projects with a Web Dev Server now have a serve target.

nx run {{project}}:serve

📖 Documentation

@robby-rabbitman/nx-plus-web-dev-server:init

Adds @robby-rabbitman/nx-plus-web-dev-server/plugin to the plugins in the nx.json.

Usage

nx g @robby-rabbitman/nx-plus-web-dev-server:init

Options

Option Type Default Description
serve-target-name string 'serve' The name of the Web Dev Server target.
skip-format boolean false Whether to skip formatting the updated files.
skip-add-plugin boolean false Whether to skip adding the plugin.

@robby-rabbitman/nx-plus-web-dev-server/plugin

Adds a serve target for projects that have a Web Dev Server config file in their root, the plugin infers a Web Dev Server with one of the following names.

  • web-dev-server.config.js
  • web-dev-server.config.cjs
  • web-dev-server.config.mjs
  • wds.config.js
  • wds.config.cjs
  • wds.config.mjs

Options

// nx.json
"plugins": [
    {
      "plugin": "@robby-rabbitman/nx-plus-web-dev-server/plugin",
      "options": {
        // the name of the web dev server target => nx run {{project}}:serve
        "serveTargetName": "serve",
        // the default configuration of the web dev server targets inferred by this plugin
        "serveTargetConfig": {
          "options":{
            "node-resolve": true
          }
        }
      }
    },
]

serveTargetConfig is different from targetDefaults since it applies only to the inferred targets and not every target.