Commit 2d1d6d6
committed
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()`
2 files changed
+26
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1072 | 1072 | | |
1073 | 1073 | | |
1074 | 1074 | | |
| 1075 | + | |
| 1076 | + | |
| 1077 | + | |
| 1078 | + | |
| 1079 | + | |
| 1080 | + | |
| 1081 | + | |
| 1082 | + | |
| 1083 | + | |
| 1084 | + | |
| 1085 | + | |
| 1086 | + | |
| 1087 | + | |
| 1088 | + | |
| 1089 | + | |
| 1090 | + | |
| 1091 | + | |
| 1092 | + | |
1075 | 1093 | | |
1076 | 1094 | | |
1077 | 1095 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
688 | 688 | | |
689 | 689 | | |
690 | 690 | | |
| 691 | + | |
| 692 | + | |
| 693 | + | |
| 694 | + | |
| 695 | + | |
| 696 | + | |
| 697 | + | |
| 698 | + | |
691 | 699 | | |
692 | 700 | | |
693 | 701 | | |
0 commit comments