pgc-dev-server
v0.0.3
Published
run a development server that provides live reloading and proxy. This should be used for **development only**.
Downloads
2
Readme
pgc-dev-server
run a development server that provides live reloading and proxy. This should be used for development only.
It uses webpack-dev-middleware under the hood, which provides fast in-memory access to the webpack assets.
It also uses webpack-hot-middleware, This allows you to add hot reloading into an existing server without webpack-dev-server.
Getting Started
First thing's first, install the module:
npm install pgc-dev-server --save-dev
Example
The config file may like this:
{
...
devServer: {
port: 3099, // the port of the dev server
proxy: {
'/api/v1/': {
target: 'http://127.0.0.1:3098',
changeOrigin: true,
log: true
},
'/sso-login': {
target: 'http://127.0.0.1:3098',
changeOrigin: true
}
},
hostProxy: {
host: 'itc.byted.org',
proxy: true,
ethernet: 'Wi-fi'
}
},
};
Usage
There are two main, recommended methods of using the module:
With the CLI
The easiest way to use it is with the CLI. In the directory where your
webpack.config.js
is, run:
node_modules/.bin/pgc-dev-server --config ./webpack.dev.config
With NPM Scripts
NPM package.json scripts are a convenient and useful means to run locally installed binaries without having to be concerned about their full paths. Simply define a script as such:
"scripts": {
"start:dev": "pgc-dev-server --config ./webpack.dev.config"
}
And run the following in your terminal/console:
npm run start:dev