зеркало из https://github.com/microsoft/just.git
Add 'open' flag to WebpackTaskOptions (#362)
* Add 'noOpen' flag to tell webpack not to open browser page. * Change files * change noOpen to open Co-authored-by: Kenneth Chau <34725+kenotron@users.noreply.github.com>
This commit is contained in:
Родитель
fba88a47fa
Коммит
14bea01d53
|
@ -0,0 +1,8 @@
|
|||
{
|
||||
"type": "minor",
|
||||
"comment": "Add 'noOpen' flag to tell webpack not to open browser page.",
|
||||
"packageName": "just-scripts",
|
||||
"email": "kinhln@microsoft.com",
|
||||
"commit": "104906e172e8379fd8e14f3b13cacd635eaaeb5f",
|
||||
"date": "2020-04-13T14:01:07.082Z"
|
||||
}
|
|
@ -24,6 +24,11 @@ export interface WebpackTaskOptions extends Configuration {
|
|||
* Environment variables to be passed to the webpack-dev-server
|
||||
*/
|
||||
env?: NodeJS.ProcessEnv;
|
||||
|
||||
/**
|
||||
* If set to true, webpack will open browser page automatically when running the dev server
|
||||
*/
|
||||
open?: boolean;
|
||||
}
|
||||
|
||||
export function webpackTask(options?: WebpackTaskOptions): TaskFunction {
|
||||
|
@ -99,7 +104,8 @@ export function webpackDevServerTask(options: WebpackTaskOptions = {}) {
|
|||
return function webpackDevServer() {
|
||||
if (devServerCmd && configPath && fs.existsSync(configPath)) {
|
||||
const mode = options.mode || 'development';
|
||||
const args = [...(options.nodeArgs || []), devServerCmd, '--config', configPath, '--open', '--mode', mode];
|
||||
const open = options.open ? '--open' : '';
|
||||
const args = [...(options.nodeArgs || []), devServerCmd, '--config', configPath, open, '--mode', mode];
|
||||
|
||||
logger.info(devServerCmd, encodeArgs(args).join(' '));
|
||||
return spawn(process.execPath, args, { stdio: 'inherit', env: options.env });
|
||||
|
|
Загрузка…
Ссылка в новой задаче