@webpackon/use-dev-server
v1.1.1
Published
Webpackon use dev-server
Downloads
3
Maintainers
Readme
@webpackon/use-dev-server
Enables dev-server and optimizes development mode.
Features:
- adds a cache for faster build in dev mode
- enable hot
Install
npm i @webpackon/use-dev-server webpack webpack-dev-server webpack-cli --save
yarn add @webpackon/use-dev-server webpack webpack-dev-server webpack-cli
API
const { useDevServer } = require('@webpackon/use-dev-server');
useDevServer(params: UseDevServerParams)(config: WebpackConfig)
UseDevServerParams
export type UseDevServerParams = {
mode: 'development' | 'production';
port?: number;
open?: boolean;
hot?: boolean;
useLocalIp?: boolean;
proxy?: Record<string, unknown>;
};
mode - webpack mode
port - webpack option
open - webpack option
hot - webpack option
useLocalIp - launches dev-server on local ip
proxy - webpack option
Example
Full examples are here
const path = require('path');
const { compose } = require('@webpackon/core');
const { useDevServer } = require('@webpackon/use-dev-server');
module.exports = (_, { mode }) =>
compose(
useDevServer({ mode })
)({
target: 'web',
entry: path.resolve(__dirname, 'src', 'index.tsx'),
});