Configure webpack-dev-server (#5786)

* setup devserver with correct proxy

* dev server wroking with written manifest

* add comments

* Change webpack to default port 9000 and minor js formatting

* Use hash in development.

* write to disk = true

* Take ports as argument for dev-server

* update instructions

* update instructions

* add devtools

* use mode instead of NODE_ENV

* use minicssextract for prod (like before)

* remove empty line
This commit is contained in:
Krist Wongsuphasawat
2018-09-04 10:39:05 -07:00
committed by Grace Guo
parent d43813ff09
commit eb41756e5e
4 changed files with 923 additions and 146 deletions

View File

@@ -261,23 +261,52 @@ To parse and generate bundled files for superset, run either of the
following commands. The `dev` flag will keep the npm script running and
re-run it upon any changes within the assets directory.
```
```bash
# Copies a conf file from the frontend to the backend
npm run sync-backend
# Compiles the production / optimized js & css
npm run prod
# Start a watcher that rebundle your assets as you modify them
npm run dev
# Start a web server that manages and updates your assets as you modify them
npm run dev
npm run dev-server
```
For every development session you will have to start a flask dev server
as well as an npm watcher
For every development session you will have to
```
1. Start a flask dev server
```bash
superset runserver -d
# or specify port
superset runserver -d -p 8081
npm run dev
```
2. Start webpack dev server
```bash
npm run dev-server
```
This will start `webpack-dev-server` at port 9000 and you can access Superset at localhost:9000.
By default, `webpack-dev-server` is configured for flask running at port 8088.
If you start flask server at another port (e.g. 8081), you have to pass an extra argument
`supersetPort` to `webpack-dev-server`
```bash
npm run dev-server -- --supersetPort=8081
```
You can also specify port for `webpack-dev-server`
```bash
npm run dev-server -- --port=9001
# or with both dev-server port and superset port
npm run dev-server -- --port=9001 --supersetPort=8081
```
#### Upgrading npm packages