Skip to content

Commit c702533

Browse files
committed
Add new methods isDev() and isDevServer()
1 parent b5750b2 commit c702533

File tree

2 files changed

+26
-0
lines changed

2 files changed

+26
-0
lines changed

index.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1072,6 +1072,24 @@ class Encore {
10721072
return webpackConfig.isProduction();
10731073
}
10741074

1075+
/**
1076+
* Is this currently a "dev" build?
1077+
*
1078+
* @returns {boolean}
1079+
*/
1080+
isDev() {
1081+
return webpackConfig.isDev();
1082+
}
1083+
1084+
/**
1085+
* Is this currently a "dev-server" build?
1086+
*
1087+
* @returns {boolean}
1088+
*/
1089+
isDevServer() {
1090+
return webpackConfig.isDevServer();
1091+
}
1092+
10751093
/**
10761094
* Use this at the bottom of your webpack.config.js file:
10771095
*

lib/WebpackConfig.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -688,6 +688,14 @@ class WebpackConfig {
688688
isProduction() {
689689
return this.runtimeConfig.environment === 'production';
690690
}
691+
692+
isDev() {
693+
return this.runtimeConfig.environment === 'dev';
694+
}
695+
696+
isDevServer() {
697+
return this.isDev() && this.runtimeConfig.useDevServer;
698+
}
691699
}
692700

693701
module.exports = WebpackConfig;

0 commit comments

Comments
 (0)