Skip to content

Commit

Permalink
Add new methods isDev() and isDevServer()
Browse files Browse the repository at this point in the history
  • Loading branch information
Kocal committed Jan 3, 2019
1 parent b5750b2 commit c702533
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
18 changes: 18 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -1072,6 +1072,24 @@ class Encore {
return webpackConfig.isProduction();
}

/**
* Is this currently a "dev" build?
*
* @returns {boolean}
*/
isDev() {
return webpackConfig.isDev();
}

/**
* Is this currently a "dev-server" build?
*
* @returns {boolean}
*/
isDevServer() {
return webpackConfig.isDevServer();
}

/**
* Use this at the bottom of your webpack.config.js file:
*
Expand Down
8 changes: 8 additions & 0 deletions lib/WebpackConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -688,6 +688,14 @@ class WebpackConfig {
isProduction() {
return this.runtimeConfig.environment === 'production';
}

isDev() {
return this.runtimeConfig.environment === 'dev';
}

isDevServer() {
return this.isDev() && this.runtimeConfig.useDevServer;
}
}

module.exports = WebpackConfig;

0 comments on commit c702533

Please sign in to comment.