New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add new methods `isDev()` and `isDevServer()` #483

Merged
merged 1 commit into from Jan 5, 2019

Conversation

Projects
None yet
3 participants
@Kocal
Copy link
Contributor

Kocal commented Jan 3, 2019

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:

const config = Encore.getWebpackConfig();

if (config.devServer) {
  // ....
}

but it means that we can't use webpack-encore methods:

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!

@Kocal

This comment has been minimized.

Copy link
Contributor

Kocal commented Jan 3, 2019

Hum, test failures are unrelated right? 🤔

@Lyrkan
Copy link
Collaborator

Lyrkan left a comment

Hi @Kocal,

Thanks for the PR, I only have a small comment about it.

And the failing test is, indeed, unrelated (it's caused by some hashes that were not updated after a recent PR).

Show resolved Hide resolved lib/WebpackConfig.js Outdated

@Kocal Kocal force-pushed the Kocal:feat/new-issers branch from 781ed54 to c702533 Jan 3, 2019

@Kocal

This comment has been minimized.

Copy link
Contributor

Kocal commented Jan 3, 2019

Removed === true from the check :)

@Lyrkan

Lyrkan approved these changes Jan 3, 2019

@weaverryan

This comment has been minimized.

Copy link
Member

weaverryan commented Jan 5, 2019

Makes good sense - thank you Hugo!

@weaverryan weaverryan merged commit c702533 into symfony:master Jan 5, 2019

0 of 2 checks passed

continuous-integration/appveyor/pr AppVeyor build failed
Details
continuous-integration/travis-ci/pr The Travis CI build failed
Details

weaverryan added a commit that referenced this pull request Jan 5, 2019

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()`

@Kocal Kocal deleted the Kocal:feat/new-issers branch Jan 5, 2019

mklkj added a commit to mklkj/planer2 that referenced this pull request Jan 6, 2019

Update @symfony/webpack-encore to the latest version 🚀 (#3)
## The dependency [@symfony/webpack-encore](https://github.com/symfony/webpack-encore) was updated from `0.21.1` to `0.22.4`.
This version is **not covered** by your **current version range**.

If you don’t accept this pull request, your project will work just like it did before. However, you might be missing out on a bunch of new features, fixes and/or performance improvements from the dependency update.

---

<details>
<summary>Release Notes for v0.22.4 - Fixing Vue + Typescript bug & other minor things</summary>

<p>Yes! A new release - but just some minor fixes.</p>
<p>To upgrade: <code>yarn upgrade</code></p>
<p>Changes: <a href="https://urls.greenkeeper.io/symfony/webpack-encore/compare/v0.22.3...v0.22.4">v0.22.3..v0.22.4</a></p>
<p>Documentation: <a href="http://symfony.com/doc/current/frontend.html" rel="nofollow">http://symfony.com/doc/current/frontend.html</a></p>
<p>Highlights:</p>
<ul>
<li><a class="issue-link js-issue-link" data-error-text="Failed to load issue title" data-id="395514756" data-permission-text="Issue title is private" data-url="symfony/webpack-encore#483" data-hovercard-type="pull_request" data-hovercard-url="/symfony/webpack-encore/pull/483/hovercard" href="https://urls.greenkeeper.io/symfony/webpack-encore/pull/483">#483</a> Add new methods <code>isDev()</code> and <code>isDevServer()</code> - thanks to <a class="user-mention" data-hovercard-type="user" data-hovercard-url="/hovercards?user_id=2103975" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://urls.greenkeeper.io/Kocal">@Kocal</a></li>
<li><a class="issue-link js-issue-link" data-error-text="Failed to load issue title" data-id="395926749" data-permission-text="Issue title is private" data-url="symfony/webpack-encore#484" data-hovercard-type="pull_request" data-hovercard-url="/symfony/webpack-encore/pull/484/hovercard" href="https://urls.greenkeeper.io/symfony/webpack-encore/pull/484">#484</a> Allow to import .vue files when using TypeScript - thanks to <a class="user-mention" data-hovercard-type="user" data-hovercard-url="/hovercards?user_id=850046" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://urls.greenkeeper.io/Lyrkan">@Lyrkan</a></li>
<li><a class="issue-link js-issue-link" data-error-text="Failed to load issue title" data-id="395930289" data-permission-text="Issue title is private" data-url="symfony/webpack-encore#485" data-hovercard-type="pull_request" data-hovercard-url="/symfony/webpack-encore/pull/485/hovercard" href="https://urls.greenkeeper.io/symfony/webpack-encore/pull/485">#485</a> Fix small mistakes in shared-entry-concat-plugin.js and validator.js - thanks to <a class="user-mention" data-hovercard-type="user" data-hovercard-url="/hovercards?user_id=850046" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://urls.greenkeeper.io/Lyrkan">@Lyrkan</a></li>
</ul>
</details>

<details>
<summary>Commits</summary>
<p>The new version differs by 32 commits.</p>
<ul>
<li><a href="https://urls.greenkeeper.io/symfony/webpack-encore/commit/70f47f6795af73e66362080f4668e00b1e048df0"><code>70f47f6</code></a> <code>Tagging 0.22.4</code></li>
<li><a href="https://urls.greenkeeper.io/symfony/webpack-encore/commit/a5191f5bf7e7cc146cf6acb3275dbb278db6d64b"><code>a5191f5</code></a> <code>bug #484 Allow to import .vue files when using TypeScript (Lyrkan)</code></li>
<li><a href="https://urls.greenkeeper.io/symfony/webpack-encore/commit/8f4178335c489926d548ae0f39a9eb4042276429"><code>8f41783</code></a> <code>minor #485 Fix small mistakes in shared-entry-concat-plugin.js and validator.js (Lyrkan)</code></li>
<li><a href="https://urls.greenkeeper.io/symfony/webpack-encore/commit/2d1d6d6e89fef7dc1dc4cb8211f514dc0ef44f01"><code>2d1d6d6</code></a> <code>feature #483 Add new methods <code>isDev()</code> and <code>isDevServer()</code> (Kocal)</code></li>
<li><a href="https://urls.greenkeeper.io/symfony/webpack-encore/commit/bf6fb63612056be37e9fdbb6d9f779b897237db3"><code>bf6fb63</code></a> <code>Tagging 0.22.3</code></li>
<li><a href="https://urls.greenkeeper.io/symfony/webpack-encore/commit/828788c1a311803c66041fd71ee8c4f41dbe4e93"><code>828788c</code></a> <code>Fix some issues in shared-entry-concat-plugin.js and validator.js</code></li>
<li><a href="https://urls.greenkeeper.io/symfony/webpack-encore/commit/8bbc3f642c304536cdeeb78d6fc44393b165b256"><code>8bbc3f6</code></a> <code>Allow to import .vue files when using TypeScript</code></li>
<li><a href="https://urls.greenkeeper.io/symfony/webpack-encore/commit/30f410eedc553b41a070132bf5a1091966fe4c48"><code>30f410e</code></a> <code>bug #481 Upgrade webpack-dev-server (cilefen)</code></li>
<li><a href="https://urls.greenkeeper.io/symfony/webpack-encore/commit/b428df53e5753ec0a69ed4fbf755c9fc3abfabb7"><code>b428df5</code></a> <code>Fix outdated hashes in one of the copyFiles functional tests</code></li>
<li><a href="https://urls.greenkeeper.io/symfony/webpack-encore/commit/c702533f998d9cbeefec20a0005a7335a7232648"><code>c702533</code></a> <code>Add new methods <code>isDev()</code> and <code>isDevServer()</code></code></li>
<li><a href="https://urls.greenkeeper.io/symfony/webpack-encore/commit/3e132176805742c740103a25df1d5c0e7ad70133"><code>3e13217</code></a> <code>Upgrade webpack-dev-server</code></li>
<li><a href="https://urls.greenkeeper.io/symfony/webpack-encore/commit/b5750b2fb09053687bcaca59b27a79a8396d304b"><code>b5750b2</code></a> <code>bug #456 Display a warning when calling "copyFiles" with an invalid path (Lyrkan)</code></li>
<li><a href="https://urls.greenkeeper.io/symfony/webpack-encore/commit/366f32c0fd366285b339700446c71476f6d048ef"><code>366f32c</code></a> <code>Tagging 0.22.2</code></li>
<li><a href="https://urls.greenkeeper.io/symfony/webpack-encore/commit/4b90883f3b4df84f1eaee75349f845d17bba6bc8"><code>4b90883</code></a> <code>bug #463 Using contenthash instead of chunkhash (weaverryan)</code></li>
<li><a href="https://urls.greenkeeper.io/symfony/webpack-encore/commit/3797cba610db5adc0e6127e68bbee02dccb9be3a"><code>3797cba</code></a> <code>Using contenthash instead of chunkhash</code></li>
</ul>
<p>There are 32 commits in total.</p>
<p>See the <a href="https://urls.greenkeeper.io/symfony/webpack-encore/compare/2a73fbc805af70c2e406dc7a62b44a581c71868f...70f47f6795af73e66362080f4668e00b1e048df0">full diff</a></p>
</details>

<details>
  <summary>FAQ and help</summary>

  There is a collection of [frequently asked questions](https://greenkeeper.io/faq.html). If those don’t help, you can always [ask the humans behind Greenkeeper](https://github.com/greenkeeperio/greenkeeper/issues/new).
</details>

---


Your [Greenkeeper](https://greenkeeper.io) bot 🌴
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment