You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feature #483 Add new methods isDev() and isDevServer() (Kocal)
This PR was merged into the master branch.
Discussion
----------
Add new methods `isDev()` and `isDevServer()`
Hi,
This PR adds two new methods `isDev()` and `isDevServer()` aside the already existing `isProduction()` method.
On a project at work, we should configure webpack-encore only when we are running the dev-server.
There is the property `runtimeConfig.useDevServer` but we don't have access to `runtimeConfig` in our `webpack.config.js`.
I know we can do this:
```js
const config = Encore.getWebpackConfig();
if (config.devServer) {
// ....
}
```
but it means that we can't use webpack-encore methods:
```js
if (Encore.isDevServer()) {
Encore
.setPublicPath('http://app.vm:8080/build/')
.setManifestKeyPrefix('build/')
}
```
Also I tried to add some tests but I didn't find tests for `isProduction()` :(
Thanks!
Commits
-------
c702533 Add new methods `isDev()` and `isDevServer()`
0 commit comments