899 B
899 B
title, description
| title | description |
|---|---|
| Examples for the Web file-server executor | This page contains examples for the Vite @nx/web:file-server executor. |
project.json:
"myapp": {
"targets": {
"serve": {
"executor": "@nx/web:file-server",
"options": {
"buildTarget": "build",
"port": 3000,
},
},
"build": {
"outputs": ["{workspaceRoot}/dist/myapp"],
"command": "echo 'Generating index.html' && mkdir -p dist && echo '<h1>Works</h1>' > dist/myapp/index.html"
},
}
}
nx serve myapp
Examples
Additional http-server options
There are additional options from http-server that can be passed as CLI args. For example, to enable directory listing, pass -d as follows:
nx serve myapp -d
Refer to the http-server package for all available options.